v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1465766489.0 KB

Returns the OAuth 2.0 token of the provided resource.

post/identities/oauth2/token

Request body

workloadIdentityTokenstring password required

The identity token of the workload from which you want to retrieve the OAuth2 token.

resourceCredentialProviderNamestring required

The name of the resource's credential provider.

scopesScopeType[] required

The OAuth scopes being requested.

oauth2Flow'USER_FEDERATION' | 'M2M' | 'ON_BEHALF_OF_TOKEN_EXCHANGE' required

The type of flow to be performed.

sessionUristring

Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.

resourceOauth2ReturnUrlstring

The callback URL to redirect to after the OAuth 2.0 token retrieval is complete. This URL must be one of the provided URLs configured for the workload identity.

forceAuthenticationboolean

Indicates whether to always initiate a new three-legged OAuth (3LO) flow, regardless of any existing session.

customParametersobject

A map of custom parameters to include in the authorization request to the resource credential provider. These parameters are in addition to the standard OAuth 2.0 flow parameters, and will not override them.

customStatestring password

An opaque string that will be sent back to the callback URL provided in resourceOauth2ReturnUrl. This state should be used to protect the callback URL of your application against CSRF attacks by ensuring the response corresponds to the original request.

resourcesResourceType[]

The resources to include in the token request. These are used to specify the target resources for which the OAuth2 token is being requested.

audiencesAudienceType[]

The audiences to include in the token request. These are used to specify the intended recipients of the OAuth2 token.

Response

Success

authorizationUrlstring password

The URL to initiate the authorization process, provided when the access token requires user authorization.

accessTokenstring password

The OAuth 2.0 access token to use.

sessionUristring

Unique identifier for the user's authorization session for retrieving OAuth2 tokens. This matches the sessionId from the request and can be used to track the session state.

sessionStatus'IN_PROGRESS' | 'FAILED'

Status indicating whether the user's authorization session is in progress or has failed. This helps determine the next steps in the OAuth2 authentication flow.