Skip to main content

Generate tokens for organization applications

You're reading Identity & Access Management 7.1.0. The newest release is 7.3.0, and Cloud has the newest features. Go to the newest release

After you authorize applications to API resources and assign users to the appropriate roles, you can generate tokens to access the protected resources. Organization applications support the following OAuth 2.0 grant types to generate tokens and issue scopes.

Password grant​

Use the following steps to use the user's credentials to get an access token.

curl --user <OAUTH_CLIENT_KEY>:<OAUTH_CLIENT_SECRET> -k
-d "grant_type=password&username=<USERNAME>&password=<PASSWORD>"
-H "Content-Type: application/x-www-form-urlencoded"
{{ root_org_url }}/o/<ORG_ID>/oauth2/token
note

If you need scopes in the response, add the scope parameter to the token request with the required scopes.

Client credentials grant​

Use the following steps to use the client credentials to get an access token.

curl --user <OAUTH_CLIENT_KEY>:<OAUTH_CLIENT_SECRET> -k
-d "grant_type=client_credentials"
-H "Content-Type: application/x-www-form-urlencoded"
{{ root_org_url }}/o/<ORG_ID>/oauth2/token
note

If you need scopes in the response, add the scope parameter to the token request with the required scopes.

Introspect tokens​

You can use the token introspection endpoint to validate access tokens issued for organization applications. The following example demonstrates how to introspect an access token.

curl --user <OAUTH_CLIENT_KEY>:<OAUTH_CLIENT_SECRET> -k
-d "token=<SUB_ORG_APP_TOKEN>"
-H "Content-Type: application/x-www-form-urlencoded"
{{ root_org_url }}/o/<ORG_ID>/oauth2/introspect

Revoke tokens​

The following example demonstrates how to revoke tokens issued for organization applications.

curl --user <OAUTH_CLIENT_KEY>:<OAUTH_CLIENT_SECRET> -k
-d "token=<SUB_ORG_APP_TOKEN>&token_type_hint=<TOKEN_TYPE>"
-H "Content-Type: application/x-www-form-urlencoded"
{{ root_org_url }}/o/<ORG_ID>/oauth2/revoke

Was this page helpful?