UserInfo details for OIDC flows

get

/oauth2/rest/userinfo

Request

Supported Media Types
Query Parameters
  • 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
Back to Top

Response

Supported Media Types

200 Response

UserInfo claims are returned according to the scope requested.
Body ()
Root Schema : UserInfoDetails
Type: object
User details returned based on scope[openid email address profile phone]
Show Source

400 Response

Bad Request
Body ()
Root Schema : ErrorCode
Type: object
Show Source
Back to Top

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"
	}
}
Back to Top