Get User Info


Use this API to get the user information related to a given access_token.

Note that the user info return by this call is determined by the scopes that were used to generate the access_token

Resource URL

https://<subdomain>.onelogin.com/oidc/2/me

Header Parameter

Authorization

required

string

Set to Bearer <access_token>.

The access_token is returned when you create a new session via Authorization Code or Password Grant

Resource Parameter

subdomain

required

string

Set to the subdomain of your OneLogin instance.

e.g. oidc-sample where the instance is https://oidc-sample.onelogin.com

Sample Response

The openid profile & email scopes were supplied in initial authorization

{
    "sub": "32916209",
    "email": "peggy.sue@onelogin.com",
    "preferred_username": "peggy.sue",
    "name": "Peggy Sue",
    "updated_at": 1590019767000,
    "given_name": "Peggy",
    "family_name": "Sue",
    "groups": [
      "Admin Role",
      "User Role",
      "Custom Roll"
    ]
}

No scopes were supplied in initial authorization

{}

Authorization header is missing

{
    "error": "invalid_request",
    "error_description": "no bearer token provided"
}

Authorization header value needs to be “Bearer access_token

{
    "error": "invalid_request",
    "error_description": "invalid authorization header value format"
}
{
    "error": "invalid_token",
    "error_description": "invalid token provided"
}

Response Elements

subThe OneLogin ID for the user that started the session
emailThe email address of the user
preferred_usernameThe username for the user. Not always an email address.
nameThe full name of the user
updated_atThe unix epoch timestamp when the users profile was last updated.
given_nameThe first name of the user
family_nameThe last name of the user
groupsIf the groups scope was supplied during authentication and the Groups parameter has been mapped on your OpenId Connect app in OneLogin then the groups claim will be returned.

Sample Code

cURL

Replace sample values indicated by < > with your actual values.

curl -XGET "https://<subdomain>.onelogin.com/oidc/2/me" \
-H "Authorization: Bearer <access_token>"

Postman Collection

Run In Postman