UserInfo details for OIDC flows
get
/oauth2/rest/userinfo
Request
Supported Media Types
- application/json
- application/x-www-form-urlencoded
Query Parameters
-
identityDomain(optional): string
Alternate query parameter name for 'x-oauth-identity-domain-name' header parameter. This can be used if header parameter can not be passed in some scenarios.
Header Parameters
-
Authorization: string
Clients must present a valid access token (of type bearer) to retrieve the UserInfo claims. Only the claims that are scoped by the token will be returned.
-
x-oauth-identity-domain-name: string
Response
Supported Media Types
- application/json
- application/json,image/png
200 Response
UserInfo claims are returned according to the scope requested.
Root Schema : UserInfoDetails
Type:
object
User details returned based on scope[openid email address profile phone]
Show Source
-
country(optional):
string
Indicates the "country" of the user
-
email(optional):
string
Email of user, corresponds to the "mail" attribute
-
email_verified(optional):
string
Default Value:
N
Is mail verified -
family_name(optional):
string
Lastname of the user
-
formatted(optional):
string
Indicates the "postaladdress" of the user
-
locale(optional):
string
preferredlanguage for the user
-
name(optional):
string
Subject of the user
-
phone_number(optional):
string
Phone number for user
-
phone_number_verified(optional):
string
Default Value:
N
Is phone number verified -
postal_code(optional):
string
Indicates the "postalcode" of the user
-
preferred_username(optional):
integer
Username
-
region(optional):
integer
Indicates the "state" of the user
-
updated_at(optional):
integer
Last update time
400 Response
Bad Request
Root Schema : ErrorCode
Type:
Show Source
object
-
errorCode(optional):
string
Error Code Generated
-
errorDesc(optional):
string
Translated Error Description
-
secErrorDesc(optional):
string
Secondary Error Message
Examples
The following examples show sample requests and response to fetch user details from the UserInfo endpoint.
Fetching Access Token with All OpenID Scopes
http://<OAM Managed Server Host>:<Port>/oauth2/rest/authorize?response_type=code&domain=DemoDomain&client_id=DemoClientID&scope=DemoResServer.scope1 openid address email phone profile&state=code1234&redirect_uri=http://localhost:8080/Sample.jsp
cURL Command to Fetch User Details
curl -X GET http://<OAM Managed Server Host>:<Port>/oauth2/rest/userinfo \ -H 'Authorization: Bearer <Access Token>' \ -H 'X-OAUTH-IDENTITY-DOMAIN-NAME: DemoDomain'
Sample Response
{ "profile": { "name": "John", "family_name": "Doe", "preferred_username": "admin", "locale": "English", "updated_at": "15283870899035" }, "email": { "email": "johndoe@company.com, "email_verified": "N" }, "address": { "formatted": "Test content", "region": "State", "postal_code": "50000", "country": "Country-India" }, "phone": { "phone_number": "3212421123", "phone_number_verified": "N" } }
Fetching Access Token with Email OpenId Scope
http://<OAM Managed Server Host>:<Port>/oauth2/rest/authorize?response_type=code&domain=DemoDomain&client_id=DemoClientID&scope=DemoResServer.scope1 openid email&state=code1234&redirect_uri=http://localhost:8080/Sample.jsp
cURL Example to Fetch Email of the User
curl -X GET http://<OAM Managed Server Host>:<Port>/oauth2/rest/userinfo \ -H 'Authorization: Bearer <Access Token>' \ -H 'X-OAUTH-IDENTITY-DOMAIN-NAME: DemoDomain'
Sample Response
{ "email": { "email": "johndoe@company.com, "email_verified": "N" } }
Fetching Access Token with Address OpenId Scope
http://<OAM Managed Server Host>:<Port>/oauth2/rest/authorize?response_type=code&domain=DemoDomain&client_id=DemoClientID&scope=DemoResServer.scope1 openid address&state=code1234&redirect_uri=http://localhost:8080/Sample.jsp
cURL Example to Fetch Address of the User
curl -X GET http://<OAM Managed Server Host>:<Port>/oauth2/rest/userinfo \ -H 'Authorization: Bearer <Access Token>' \ -H 'X-OAUTH-IDENTITY-DOMAIN-NAME: DemoDomain'
Sample Response
{ "address": { "formatted": "Test content", "region": "State", "postal_code": "50000", "country": "Country-India" } }