Create Access Token Flow

post

/oauth2/rest/token

Request

Supported Media Types
Query Parameters
  • Identity Domain under which the token is being requested. This is an optional parameter if 'x-oauth-identity-domain-name' header parameter is provided.
Header Parameters
Form Parameters
  • User Assertion token.Mandatory parameter in case GrantType is JWT_BEARER.
  • Client Assertion token. This is mandatory if the Client Authentication mechanism is via the ClientAssertionToken. If this is passed, then the authorization header is not required.
  • Type of client assertion. This is mandatory if the Client Authentication mechanism is via the ClientAssertionToken. If this is passed, then the authorization header is not required.
    Allowed Values: [ "JWT_BEARER", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" ]
  • Authorization Code obtained.Mandatory parameter in case GrantType is AUTHORIZATION_CODE.
  • Grant Type for the Access Token Request
    Allowed Values: [ "CLIENT_CREDENTIALS", "AUTHORIZATION_CODE", "PASSWORD", "JWT_BEARER", "REFRESH_TOKEN" ]
  • Password of resource owner.Mandatory parameter in case GrantType is PASSWORD.
  • Redirect URI.Mandatory parameter in case GrantType is AUTHORIZATION_CODE.
  • Refresh Token played to generate the new Access Token.Mandatory parameter in case GrantType is REFRESH_TOKEN.
  • Scope requested in the Access Token. In case of REFRESH_TOKEN flows, defaulted to the values in the RefreshToken if not specified. In case JWT_BEARER flow access token requests UserInfo related scopes, supported scopes are UserInfo.me, UserInfo.email, UserInfo.profile, UserInfo.address or UserInfo.phone.
    Default Value: DefaultScope defined for Client
  • Username of resource owner. Mandatory parameter in case GrantType is PASSWORD.
Back to Top

Response

Supported Media Types

200 Response

Access Token was generated successfully
Body ()
Root Schema : AccessToken
Type: object
Show Source

400 Response

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

Examples

The following cURL command shows a sample request against the server for creating access tokens using Resource Owner Credentials in 2 - Legged Flows.

Note:

Headers of interest in requests

  • Authorization : Base64 Url encoded ClientID:secret combination. 

  • X-OAUTH-IDENTITY-DOMAIN-NAME: Identity Domain that the client belongs to.

cURL Example

curl -i -H 'Authorization: Basic U1NPTGlua0NsaWVudDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -H "X-OAUTH-IDENTITY-DOMAIN-NAME: SSOLink" --request POST http://<ManagedServerHost>:<ManagedServerPort>/oauth2/rest/token -d 'grant_type=PASSWORD&username=<username>&password=<password>&scope=SSOLink.link1'

cURL Eamples for Create Token

curl -i -H 'Authorization: Basic U1NPTGlua0NsaWVudDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -H "X-OAUTH-IDENTITY-DOMAIN-NAME: SSOLink" --request POST http://<ManagedServerHost>:<ManagedServerPort>/oauth2/rest/token -d 'grant_type=PASSWORD&username=<username>&password=<password>&scope=SSOLink.link1'
curl -i -H 'Authorization: Basic U1NPTGlua0NsaWVudDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST 'http://<ManagedServerHost>:<ManagedServerPort>/oauth2/rest/token?identityDomain=SSOLink' -d 'grant_type=PASSWORD&username=<username>&password=<password>&scope=SSOLink.link1'
Back to Top