Learn how to configure token exchange for agent-to-agent connections so that AI agents can securely call each other as part of automated workflows. This document discusses the token exchange flows that pertain to the agent-to-agent self-service Early Access feature. For the Generally Available token exchange flows, see Set up AI agent token exchange.
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 and has the agent-to-agent connections feature enabled. To enable this feature, go to Settings > Features, locate the Secure AI A2A Servers feature, and enable it.
An Okta admin account with the super admin role.
Custom scopes defined in your Okta custom authorization server for each resource app where you're requesting access. These scopes specify what permissions the token exchange grants in the final access token. You select these scopes when you connect AI agents to resource connections(opens new window).
A delegation link that's configured for each AI agent, defining the users, apps, and other AI agents that can authorize the AI agent to act on their behalf. See the Add delegations section of the Add AI agents manually(opens new window) page.
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.
Authorization server: Grants the AI agent access to resources that are protected by an Okta custom authorization server. This resource type is supported by Cross App Access(opens new window), which uses ID-JAG (Identity Assertion JWT).
Secret: Uses a static credential for a downstream resource that has been vaulted in Okta Privileged Access.
Service account: Uses a static credential for an app that's specified in Universal Directory. This resource is vaulted in Okta Privileged Access.
Resource server: Uses a third-party access token that's issued by the third-party authorization server and brokered by Okta. This resource type requires user consent before an AI agent can act on behalf of the user.
Agent-to-agent: Allows one AI agent to securely invoke another AI agent as a downstream resource protected by an Okta custom authorization server. Through token exchange, the original service identity is maintained across both agents while each obtains specific access tokens for its next connection. This resource type is supported by Cross App Access, which uses the Identity Assertion JWT (ID-JAG).
Ater the resource type is configured and the AI agent has the token or credentials, it can then perform tasks on the connected app.
Token Exchange flow
The following diagram describes the
resource type. If you want to change the resource type on this page, select that type from the Instructions for dropdown list on the right.
Flow specifics
Note: The instructions on this page are for the
resource type. If you want to change the resource type on this page, select that type from the Instructions for dropdown list on the right.
Initial authentication
To initiate the token exchange flow, the client must first authenticate with the appropriate Okta authorization server and obtain a subject token (either an ID token or an access token) that satisfies a delegation link for the AI agent.
ID token
To obtain a subject token for a user, the 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 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 AI agent 1. This is the agent that will perform token exchange.