Agent to Agent Token Exchange

Delegate a client's identity through two AI agents with a cryptographically chained act trail (Okta EA)

Configuration
Agent to Agent Token Exchange Flow

Client phase. The flow starts with a subject token that represents the client identity — a user (via login) or a service (via client credentials). This token is the identity that will be delegated through both agents.

1
Client

Obtain Subject Token

Get the token that represents the client identity. Log a user in (Auth Code + PKCE — login always uses openid profile email), authenticate a service with client credentials, or pick an existing token from the wallet.

/oauth2/default/v1/authorize
Configuration
/oauth2/default/v1/
cURL Command

          
        

Agent 1 phase. The client hands its token to Agent 1, which adds itself to the delegation chain: it exchanges the subject token for an Identity JWT Authorization Grant (ID-JAG) signed proof, then redeems that grant for its own access token. The resulting token carries act.sub = Agent 1.

2
Agent 1

Token Exchange — Obtain ID-JAG (T2)

Agent 1 exchanges the subject token for an Identity JWT Authorization Grant via RFC 8693 Token Exchange at the org authorization server, authenticating with a JWT client assertion signed by Agent 1's private key.

/oauth2/v1/token grant_type=urn:ietf:params:oauth:grant-type:token-exchange
Configuration
Configure Okta Domain and the custom auth server (Step 3) to load scopes
cURL Command

          
        
3
Agent 1

JWT Bearer — Obtain Access Token (T3)

Agent 1 presents the ID-JAG as a JWT Bearer assertion (RFC 7523) to the custom authorization server and receives its delegated access token. The ID-JAG is short-lived (5 minutes).

/oauth2/{authServerId}/v1/token grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
Configuration
cURL Command

          
        

Agent 2 phase. Agent 1 now delegates to Agent 2 the same way: Agent 2 exchanges Agent 1's access token for a new ID-JAG signed with Agent 2's key, then redeems it. The act chain grows to Client → Agent 1 → Agent 2, nested cryptographically inside the token.

4
Agent 2

Token Exchange — Obtain ID-JAG (T4)

Agent 2 exchanges Agent 1's access token (T3) for a new Identity JWT Authorization Grant at the org authorization server, authenticating with a JWT client assertion signed by Agent 2's private key.

/oauth2/v1/token grant_type=urn:ietf:params:oauth:grant-type:token-exchange
Configuration
cURL Command

          
        
5
Agent 2

JWT Bearer — Obtain Access Token (T5)

Agent 2 presents its ID-JAG as a JWT Bearer assertion (RFC 7523) to the custom authorization server and receives the final delegated access token carrying the full act chain.

/oauth2/{authServerId}/v1/token grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
Configuration
cURL Command

          
        

Resource phase. Agent 2 calls the downstream API with the final token (T5). The resource server can verify the entire delegation trail — who the subject is and exactly which agents acted on its behalf — straight from the token's nested act claims.

6
Agent 2 Optional

Test Token with API

Test the final access token (T5) by making an authenticated API request to a resource server.

cURL Command