Beginning in October, Okta release version notations are changing from year.month to year.week. For example, 2026.10.0 will become 2026.41.0, where 41 indicates that week of the year that the deployment occurs. More information is available in this knowledge base article.
Learn how to configure token exchange for AI agents so that you can securely request and use credentials (ID-JAG, secrets, service accounts, or third-party access tokens) to access protected resources on behalf of authenticated users, and so that AI agents can securely call each other as part of automated workflows (agent-to-agent).
Learning outcomes
Understand how to set up the token exchange flow for AI agents.
What you need
An Okta org that's subscribed to Okta for AI Agents
If you're connecting to an Okta custom authorization server, define the custom scopes for each resource app where you're requesting access. These scopes specify what permissions the token exchange grants in the final access token.
You've also created resource connections(opens new window) that define the AI agent's access to your org's resources. Now, the agent must obtain the actual tokens or credentials to perform tasks.
Note: The connectionType(opens new window) property in the AI Agent Connections API identifies how an AI agent obtains credentials for a resource. Okta uses this value to determine which token exchange flow to apply to the connection.
Select Authorization server (ID-JAG) from the Instructions for dropdown on the right to review the authorization server token exchange flow.
Secret
Secret (STS_VAULT_SECRET(opens new window)) Uses a static credential for a downstream resource that has been vaulted in Okta Privileged Access (OPA).
Select Secret from the Instructions for dropdown on the right to review the OPA vaulted secret STS token exchange flow.
Service account
Service account (STS_SERVICE_ACCOUNT(opens new window)) Uses a static credential for an app that's specified in Universal Directory. This resource is vaulted in Okta Privileged Access.
Select Service account from the Instructions for dropdown on the right to review the OPA service account static credentials token exchange flow.
Application
Okta supports the following connections for app resources:
Select Authorization server (ID-JAG) from the Instructions for dropdown on the right to review the XAA authorization server token exchange flow.
Brokered consent STS (STS_ACCESS_TOKEN(opens new window)) Uses a third-party access token that's issued by the third-party authorization server and brokered by Okta. This connection flow requires user consent before an AI agent can act on behalf of the user.
Select OAuth STS from the Instructions for dropdown on the right to review the brokered consent STS token exchange flow.
MCP server
Okta supports the following connections for MCP server resources:
Select MCP server from the Instructions for dropdown on the right to review the XAA MCP server token exchange flow.
Brokered consent STS (STS_ACCESS_TOKEN(opens new window)) Uses a third-party access token that's issued by the third-party authorization server and brokered by Okta. This connection flow requires user consent before an AI agent can act on behalf of the user.
Select OAuth STS from the Instructions for dropdown on the right to review the brokered consent STS token exchange flow.
Connect to another AI Agent
Cross App Access (Agent-to-agent) (IDENTITY_ASSERTION_A2A_SERVER(opens new window)) Allows one AI agent to securely invoke another AI agent as a downstream resource protected by an Okta custom authorization server. Through XAA token exchange, the original service identity is maintained across both agents while each obtains specific access tokens for its next connection.
Select Agent-to-agent from the Instructions for dropdown on the right to review the AI agent-to-agent token exchange flow.
After the resource type is configured and the AI agent has the token or credentials, it can then perform tasks on the connected resource.
Note: If you're integrating a third-party AI agent platform, such as AWS Bedrock or Azure AI Foundry, see Set up third-party AI Agent token exchange. This guide provides a complete setup walkthrough and a functional demo that you can test end to end.
Note: This guide describes the token exchange when Okta issues the ID-JAG. If your agent holds an ID-JAG issued directly by an external IdP or by another Okta org, it presents that ID-JAG directly to your custom authorization server and doesn't use the org authorization server exchange that's described here. See Configure XAA with an external IdP.
Token exchange flow
The following diagrams and steps describe the
token exchange flow. If you want to change the token exchange flow on this page, select that flow from the Instructions for dropdown list on the right.
Authenticate with Okta
The exchange flow
Flow specifics
Note: The instructions on this page are for the
token exchange flow. If you want to change the token exchange flow on this page, select that flow from the Instructions for dropdown list on the right.
Initial authentication
To initiate token exchange, the AI agent (user access configuration) or client (machine access configuration) must first authenticate with the appropriate Okta authorization server and obtain a subject token (either an ID token or an access token). This token must satisfy the access requirements for the AI agent.
Note: Okta also accepts the CIMD URL as the client_id in an OAuth request, just as it would a static client ID. See Use the CIMD client ID in a token request for more detailed information.
ID token
To obtain a subject token (subject_token) for a user, the AI agent or client sends a request to the Okta org or custom authorization server to obtain an ID token. Use the Authorization Code with PKCE grant type to obtain an authorization code for the client. See Implement authorization by grant type.
Response
The response contains the access and ID token and the openid scope.
To obtain a subject token (subject_token) for itself, the client sends a request to an Okta custom authorization server to obtain an access token. Use the Client Credentials grant type to obtain the subject token. See Implement authorization by grant type.
The request includes the resource parameter. The parameter value is the resource URL that's configured on the agent that this client is invoking. For example resource: https://agent1.example.com.
Response
The token returned in the response contains the aud claim. The claim value is the resource URL (https://agent1.example.com) for the AI agent. This is the agent that performs token exchange.
token exchange flow. If you want to change the token exchange flow on this page, select that flow from the Instructions for dropdown list on the right.