How to use /introspect/{appID} API to identify scope of a bearer token
Objective
When working with Bearer, Access, Refresh, or ID tokens, it is commonly necessary to verify the required scope is provided in the token when attempting to integrate solutions such as SCIM IGA integration or OIDC Application access.
Idira Identity has an available /oauth2/introspect/{appID} API that can be used to identify specific information in a given token.
Environment
Identity App Access Service
Procedure
You will need:
- CyberArk Identity Tenant ID (ex. https://abc0123.id.cyberark.cloud)
- Application ID of OIDC app that issued the token (ex. "IGA")
- Bearer, Access, Refresh, or ID token provided by CyberArk Identity tenant admin
- Method of sending an API call to CyberArk API endpoints (Bruno, Postman, cURL, etc)
In this example, we will be using the /introspect/{appID} API call to examine a token issued to a user called "test@abc0123" provided by an OIDC application called "IGA" using the Bruno API client
The call will be a POST:
The authorization will be in the form of a token issued to a user with rights to make API calls against the CyberArk Identity tenant, which in this case will be for the primary Cloud Amin.
The Body will be "Token" followed by the bearer token we are examining. For this example, we will be using Form URL Encoded:
Key: token
Value: <bearer token we are inspecting>
The Response will be similar to the following:
{
"iss": "https://abc0123.id.cyberark.cloud/",
"auth_time": _________
"iat": ___________,
"aud": "__________",
"active": true,
"unique_name": "test@abc0123",
"app_id": "IGA",
"exp": ____________,
"sub": "_______-________-_______",
"scope": "SCIM"
}
Displayed in these results will be the Issuer, timestamp (auth time), token status (active), user (unique_name), application ID, expiration of the token, token subject, and all the assigned scopes for the token.
Further details about this API can be found here: https://api-docs.cyberark.com/docs/identity-api-reference/authentication-and-authorization/operations/create-a-o-auth-2-introspect