Join us at Okta Developer Connect San Francisco on April 30 at Okta HQ to explore how Okta secures AI agents with modern identity.

Instructions for

On this page

Set up AI agent token exchange

Identity Engine

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 accesst okens) to access protected resources on behalf of authenticated users.


Learning outcomes

  • Understand how to set up the token exchange flow for an AI Agent.

What you need


Overview

You've registered an AI agent (opens new window). You have also defined its access to third-party resources integrated with your Okta org using Managed Connections. Now, the agent must obtain the actual tokens or credentials to perform tasks.

You can connect an AI agent (opens new window) to the following resource types:

  • 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) (XAA), 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 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.

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 the resource type that you want 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 the resource type you want from the Instructions for dropdown list on the right.

Authorization Code with PKCE request

To initiate the token exchange flow, the client must first obtain an ID token from the org authorization server.

Note: You must use the org authorization server and not the custom authorization server for this step.

Use the Authorization Code with PKCE flow to obtain an authorization code for the client. See Implement authorization by grant type.

Exchange token ID for resource token

Note: The instructions on this page are for the

resource type. If you want to change the resource type on this page, select the resource type you want from the Instructions for dropdown list on the right.

Response

The response contains the requested resource token.