Image: d2908q01vomqb2.cloudfront.net · rights & removal
Delegate user access to AI agents with Amazon Cognito token exchange
Reporting by AWS Security BlogRead the original at aws.amazon.com
Executive Summary
Amazon Cognito introduces OAuth 2.0 Token Exchange (RFC 8693) to manage complex, multi-step API interactions, particularly relevant for integrating AI agents. Traditionally, when one service calls a downstream API on behalf of a user, forwarding the original user token either hides the service actor or strips user identity. Token exchange resolves this by allowing a calling service to present the user's consent token alongside its own credentials to the authorization server. The server issues a new, derived token that identifies the original user while also clearly naming the service that initiated the request, using the `act` claim for delegation.
This mechanism supports two modes: Impersonation, where the calling service acts purely as a relay and does not identify itself to the resource server, and Delegation, where the service asserts its identity. Delegation is highlighted as crucial for auditability and authorization in agentic workloads, ensuring that while the user identity is maintained in the subject (`sub`) claim, the specific service responsible for the action is logged in the `act` claim. The system imposes security constraints, ensuring the issued token's scope is strictly limited to what both the user token and the service client permit.
Facts Only
Token exchange is defined in RFC 8693.
Amazon Cognito serves as the OAuth 2.0 authorization server for this feature.
An initial subject token, issued by a user pool, represents the user.
The calling service sends the subject token and its own credentials to the authorization server.
The authorization server issues a new, derived token.
Token exchange supports two patterns: Impersonation and Delegation.
In delegation, the calling service sends an actor token, which causes Cognito to add an `act` claim naming the service.
Impersonation results in an issued token that represents only the user, lacking an `act` claim.
Security checks performed by Cognito include validating the subject token's signature and expiry.
The issued token carries only scopes permitted by both the subject token and the app client.
Token exchange can be enabled for an application client by selecting `ALLOWTOKENEXCHANGEDELEGATION` or `ALLOWTOKENEXCHANGEIMPERSONATION` in Cognito.
Full Take
This architecture fundamentally addresses the challenge of distributed agency in modern, service-mesh environments, particularly those increasingly populated by autonomous AI agents. The system moves beyond simple delegation, which often leaves opaque gaps in accountability. By enforcing delegation via the `act` claim, the system establishes a traceable chain of responsibility: User $\rightarrow$ Service $\rightarrow$ Resource API. This is a sophisticated architectural solution to the inherent "black box" problem of deep service invocation.
The core assumption underlying this design is that authorization requirements are not monolithic; they must be granular and contextual to the current hop. When agents interact with tools—which are themselves services—the system demands that the permissions granted to the *intermediary* service be exactly those needed for the specific sub-task, preventing scope creep across the entire user session. The tension between impersonation (trusting the user entirely) and delegation (trusting the validated service) highlights a choice in governance: Is the risk mitigated by knowing *who* is making the request, or is it sufficient to know *whose* credentials are being used?
The mechanism itself—requesting a token based on another token—is an abstraction layer over credential management, effectively outsourcing trust validation to the authorization server. This shifts the security burden from relying solely on service-to-service mutual TLS or static credentials to a dynamic, consent-driven token flow. The cost is architectural complexity; implementing this requires rigorous configuration of client IDs, secrets, and specific flow permissions across the user pool and calling services.
Patterns detected: none
Autonomy check: No autonomy signals.
From the original · AWS Security Blog
AWS Security Blog Delegate user access to AI agents with Amazon Cognito token exchange Suppose you use a restaurant review app to check reviews, book tables, and email invitations to your friends.Read the full story at aws.amazon.com
Sentinel unavailable
The automated check of the source article's wording did not complete, so no result is shown.
This looks only at the wording of the original source article, not at this page's AI-written sections. A small local AI model made this estimate. It has not been checked against known human and machine texts, so treat it as provisional. It cannot show who wrote an article.
