Introspect with Bearer Token
POST/token-srv/introspect
Token Introspection (RFC 7662)
This API validates an OAuth 2.0 access token and returns information about its active state and associated metadata. It is the recommended method for online token validation when you need to:
- Detect revoked tokens in real-time
- Validate token scopes before granting access to protected resources
- Perform group and role validations that require server-side checks
- Get complete token metadata including expiration, client ID, and user information
Security:
- Authorization Header (Optional but Recommended): The endpoint accepts an optional
Authorizationheader with either:- Basic Authentication:
Basic <base64(client_id:client_secret)>- Validates client credentials - Bearer Token:
Bearer <access_token>- Validates the bearer token signature
- Basic Authentication:
- Note: While the authorization header is optional in the current implementation, RFC 7662 recommends requiring authentication. For production use, it's recommended to always provide authentication.
- The token to introspect must be provided in the request body.
Token Validation: The endpoint validates the token and checks:
- Token is not revoked, logged out, or renewed
- Token has not expired
- Client is in the token's audience
- (If validation parameters provided) Token matches the requested scopes/roles/groups criteria
Response Format:
- When
active: true: Returns full token metadata including:scope(space-separated string) andscopes(array) - All scopes associated with the tokenroles(array) - All roles associated with the tokengroups(array) - All groups associated with the token (if present)- Standard JWT claims:
sub,aud,iss,exp,iat,nbf,jti client_id- Client ID that issued the tokentoken_type- Type of token: "Bearer", "DPoP" (for DPoP-bound tokens), or the token_type_hint valuecnf- Confirmation claim (for DPoP-bound tokens, containsjkt)- Custom claims from the token
- When
active: false: Returns onlyactive: falsewith no additional fields (as per RFC 7662) - The
activefield is set tofalseif:- Token is invalid, expired, revoked, logged out, or renewed
- Client is not in the token's audience
- Token not found in database
- (If validation parameters provided) Token doesn't match the requested scopes/roles/groups AND strict validation is enabled
Request Body Validation (Optional):
You can optionally provide scopes, roles, or groups in the request body to perform additional validation:
scopes- Array of scopes to validate- If
strictScopeValidation: true: Token must contain ALL specified scopes - If
strictScopeValidation: false(default): Token must contain AT LEAST ONE specified scope
- If
roles- Array of roles to validate- If
strictRoleValidation: true: Token must contain ALL specified roles - If
strictRoleValidation: false(default): Token must contain AT LEAST ONE specified role
- If
groups- Array of group validation criteria (groupId, groupType, roles)- If
strictGroupValidation: true: Token must match ALL specified groups - If
strictGroupValidation: false(default): Token must match AT LEAST ONE specified group - Each group can have
strictRoleValidationfor role matching within that group
- If
strictValidation: true- Requires ALL of the following to be true: groupValid AND roleValid AND scopeValidstrictValidation: false(default) - Requires AT LEAST ONE of the following to be true: groupValid OR roleValid OR scopeValid
Important Notes:
- When validation parameters are provided, the introspection performs additional checks beyond token validity
- If the token is valid but doesn't match the specified scopes, roles, or groups, the response will indicate
active: false(if strict validation) oractive: truewith returned scopes/roles that you should verify - For DPoP-bound tokens, the
token_typewill be set to "DPoP" and thecnf.jktclaim will be included - Anonymous users with NON_INTERACTIVE client types skip group/role validation
For more details on scope validation, see Scope Management and Permission Management.
Request
Responses
- 200
- 400
- 401
OK
Bad Request
Unauthorized