AI Infrastructureamazon-cognito

Amazon Cognito Token Exchange for AI Agents: Scoped Tokens for Downstream Calls

P&C

Prompt & Circuit Editorial

November 13, 2026 · 12 Min Read

Amazon Cognito Token Exchange for AI Agents: Scoped Tokens for Downstream Calls

Why this matters for agent architectures

An agent that calls other services for a user has an identity problem: the downstream service needs to know who the request is for, and who is actually making it. Amazon Cognito announced support for OAuth 2.0 token exchange (RFC 8693) on November 12, 2026, and the announcement names AI agents explicitly among the callers it targets [1]. Before this, a service that called another service on a user's behalf had to forward the user's original token or build and maintain its own token minting logic [1].

This article covers what the announcement says, how it fits the authorization patterns AWS has already published for agents, and which questions to settle before you design around it. One caveat up front: the detailed request parameters live in the Developer Guide section on exchanging tokens for downstream services, which the announcement points to [1]. We could not retrieve that page, so this article does not describe request syntax, and you should read the guide before implementing.

What token exchange gives you

According to the announcement, a service or AI agent acting on a user's behalf can exchange the user's token for a new token scoped to a specific downstream service [1]. The new token can differ from the original in three ways [1]:

  • It has a narrower scope than the original token.
  • It is bound to a single audience.
  • It comes without a refresh token.

Each property narrows what the intermediary holds: less scope, one audience, and no refresh token [1]. Compare this with the previous workaround of forwarding the original token, which gives the downstream call the original token rather than a purpose-built one [1].

The actor claim

When you include an actor token, Cognito adds an act claim that identifies the intermediary, so downstream services can tell a request an agent made on a user's behalf from one the user made directly [1]. The announcement's example is a Model Context Protocol (MCP) server that exchanges a user's token for a narrowly scoped token to call a backend API, with the act claim recording the MCP server as the actor [1]. For architects this matters for auditing and for policy: a backend can apply different rules, or at least different logging, to delegated calls.

Two ways to exchange

You can exchange tokens through the token endpoint or with the new GetDerivedToken API [1]. The announcement does not say when to prefer one over the other. The token endpoint reference we retrieved lists authorization_code, refresh_token and client_credentials as the grant types it accepts, so check whether the current version of that page documents the exchange grant before assuming parity [2].

Availability and plan constraints

Token exchange is available on the Essentials and Plus feature plans in all AWS Regions where Amazon Cognito is available [1]. Cognito feature plans are set per user pool, and different user pools in the same AWS account can have different plans [3]. You cannot apply separate feature plans to app clients within a user pool [3]. The default plan for new user pools is Essentials, and you can switch between plans at any time, although some changes require you to turn off active features [3].

The plan-level constraint has a practical consequence. If an existing pool runs on the Lite plan, token exchange is not in the announced availability, so adopting it means a plan change for that whole pool rather than for one app client [1][3]. The feature plans page describes Lite as a low-cost plan, notes that many newer features are not included in it, and says that billing depends on the features you choose and the number of monthly active users, among other factors [3]. For current prices, the page directs you to the Amazon Cognito pricing page, and we do not quote figures here [3].

How it fits the published agent patterns

AWS's security blog on propagating user authorization context describes the design principle that token exchange supports: the agent acts as an orchestrator, not a gatekeeper, and authorization is enforced by downstream services [4]. That post describes an on-behalf-of token exchange based on RFC 8693 performed by Amazon Bedrock AgentCore Identity against an external service, rather than by Cognito itself [4]. Cognito acts as the identity provider in that architecture [4]. The new Cognito capability is a different building block: it lets the identity provider itself issue the narrowed token.

The blog also compares three OAuth patterns for external service access [4]:

  • Client credentials (machine-to-machine): the agent authenticates as a service account and receives a token with broad access, so the agent is then responsible for filtering data in queries [4].
  • Authorization code: the user consents through a browser redirect, which demands user interaction and is impractical for background agent operations [4].
  • On-behalf-of token exchange: the user's already-authenticated identity is exchanged for a service-scoped token without additional user interaction, and the external service enforces access [4].

Cognito's new capability is closest to the third pattern, since its stated purpose is exchanging a user's token for one scoped to a downstream service [1]. For an external service such as Salesforce, the AgentCore Identity approach from the blog is the documented route [4].

Design considerations and failure modes

Several constraints from the sources shape a sound design.

Token size and storage. Cognito's documentation notes that token size can change for reasons including additional claims, and that your app must be able to store tokens of varying sizes [5]. Adding an act claim and custom claims increases what every hop must carry, so test header limits on gateways and proxies.

Claim customization is a separate feature. Customizing access token scopes and claims at runtime with a Lambda trigger is listed as available on the Essentials and Plus plans [3]. In the AgentCore example, a pre token generation Lambda trigger adds a custom claim to the tokens [4]. If you plan to scope exchanged tokens by attributes such as department or role, confirm how the exchange interacts with that trigger, because the announcement does not address it [1].

Enforce at the infrastructure layer. The AWS blog argues that granting an agent broad credentials and relying on application-level filtering creates a single point of failure, since a prompt injection or a filtering bug could expose the full dataset [4]. A narrower, audience-bound token helps only if the downstream service checks the audience and scope it receives [1].

Audience validation applies elsewhere too. In the same blog, AWS STS validates the token's audience claim against the IAM OIDC provider configuration, which prevents tokens issued for other app clients from being used to assume a role [4]. Treat audience checks as mandatory on every service in the chain.

Decision table

SituationOption from the sourcesWhy
Agent or MCP server calls a downstream service on a user's behalfCognito token exchange [1]Narrow scope, single audience, no refresh token, optional act claim
Agent calls a third-party SaaS that supports RFC 8693AgentCore Identity on-behalf-of exchange [4]Documented pattern with the external service enforcing access
Background job needs organization-wide data, not per-user dataClient credentials [4]Broad token, so the agent must filter results
Flow can interrupt the user for consentAuthorization code [4]Requires a browser redirect
Existing pool is on the Lite planPlan change first [1][3]Token exchange is announced for Essentials and Plus

Architect's checklist

  • Confirm the feature plan of each user pool that issues tokens for agents; token exchange is announced for Essentials and Plus only.
  • Read the Developer Guide section on exchanging tokens for downstream services before designing request flows, since this article does not cover request parameters.
  • Decide per hop whether to use the token endpoint or the GetDerivedToken API, and document the reason.
  • Include an actor token where downstream services need to distinguish delegated calls from direct ones, and log the act claim.
  • Require every downstream service to validate audience and scope, so the narrower token has an effect.
  • Do not plan on a refresh token for exchanged tokens, because they come without one.
  • Test token and header size limits with the extra claims your design adds.
  • Keep authorization decisions in downstream services and infrastructure rather than in agent code.
  • Check pricing on the official Amazon Cognito pricing page before moving pools between plans.

Sources

Numbers in square brackets refer to these sources, checked on 2026-11-13.

  1. Amazon Cognito now supports OAuth 2.0 token exchange - AWS
  2. The token endpoint - Amazon Cognito
  3. User pool feature plans - Amazon Cognito
  4. Propagate user authorization context in AI agents with Amazon Bedrock AgentCore | AWS Security Blog
  5. Understanding user pool JSON web tokens (JWTs) - Amazon Cognito
Tags:amazon-cognitoagent-identityoauthsecurity
Share Article

Responses (0)

Sign in to join the conversation and share your thoughts.

P&C

Prompt & Circuit Editorial

Contributing Editor

Articles on AI infrastructure for cloud architects, written from official vendor sources and checked claim by claim before publishing.