Cognito Token Exchange Gives Agents Narrower Credentials, with One Important Trust Decision
Amazon Cognito's OAuth token exchange can bind a short-lived token to one downstream service and record an acting service in the act claim.
On this page
An agent that can call five services should not need to carry a broad user token into all five. Each service is a different security boundary, with a different audience and set of actions. Cognito’s new token-exchange flow gives teams a way to derive a credential for one downstream resource rather than forwarding the original bearer token everywhere.

What the exchange produces
The Cognito Developer Guide describes two inputs. A subject token represents the user. An optional actor token represents the service performing the exchange. Cognito returns an access or ID token for the downstream service, bound to a configured resource audience and requested scopes.
The output is down-scoped. The guide says the issued scopes are the intersection of the scopes requested, the scopes in the subject token, and the scopes the app client can issue. An exchange cannot add authority that the subject token did not already carry. It also issues no refresh token, and the derived token cannot outlive the credential from which it was derived. The downstream service must still validate signature, issuer, expiration, audience, and the relevant claims.
The optional actor token changes the meaning of the request. Without it, the result represents the user acting directly. With it, Cognito includes an act claim identifying the intermediary. A backend can use that claim for policy or audit logging—for example, “the user authorized this read, and service X made the downstream call.” It should not blindly treat any actor listed in a valid token as trusted; the issuer’s configuration and the downstream policy still decide which actors are acceptable.
This matches the purpose of RFC 8693, which standardizes exchanging one token for another across security domains. It is different from client-credentials or machine-to-machine authorization, where the application itself—not a user—is the principal. Teams designing a login and API flow can also refer to our guide on OIDC and token boundaries and our API authorization checklist.
Where the trust decision lives
A narrower token is only useful if the resource server checks it. The downstream API should accept only the intended audience, enforce the included scopes, validate token lifetime, and decide whether the act identity is allowed to perform the requested operation. Logging should preserve both the subject and actor so an audit trail does not flatten a delegated action into “the user did it.”
The Cognito docs call this feature available for user pools on Essentials and Plus plans. It can be invoked through the GetDerivedToken API or the OAuth token endpoint. The guide also documents that registered external OIDC or SAML identities must already be linked to a user in the pool; token exchange does not create that user. Cognito currently does not issue or evaluate the RFC’s may_act claim, so the issuer’s prior authorization of a particular actor is not supplied automatically by that claim.
That last detail is easy to miss. An act claim tells the resource which intermediary is acting. It is not by itself proof that this intermediary was pre-authorized for every operation. Applications should constrain which clients can request delegation, which actor token identities they accept, and which audiences/scopes can be issued. Keep the token exchange at a trusted server boundary, and never expose a confidential app client secret to a browser.
A practical adoption checklist
- Pick the boundary first. Name the downstream resource and its exact audience before configuring an exchange.
- Request the minimum scopes. Cognito intersects requested, subject-token, and app-client scopes, but the client should still request only what the operation needs.
- Decide between impersonation and delegation. If downstream services need to know a service acted for the user, include the actor token and define how the
actclaim is authorized and logged. - Validate at the resource. Check issuer, signature, expiration, audience, scopes, and any actor policy on every protected request.
- Plan for short expiry. No refresh token is issued. Cache or renew derived tokens through a trusted server-side flow without extending them beyond the subject credential’s validity.
- Test negative cases. Try an unregistered audience, a scope not present in the subject token, an expired subject, and an untrusted actor. Each should fail closed.
The launch is useful for services and agents that currently forward a general-purpose user token to several APIs. It offers a standard-shaped way to mint a narrower, single-audience credential and preserve the identity of the intermediary. That is a better building block for delegated access, but authorization remains a system design decision—not something an exchange protocol can make on a team’s behalf.
Frequently asked questions
Does Cognito token exchange guarantee least privilege automatically?
No. Cognito constrains the output to requested scopes that are also present in the subject token and allowed for the app client, and it binds the token to a resource audience. Your resource server must still validate the token and enforce its own authorization rules.
What does Cognito's act claim identify?
When an actor token is supplied for delegation, Cognito includes an act claim with identity claims for the intermediary. A downstream service can use it to distinguish delegated activity from a user acting directly.

/* Comments */
Comments are offline right now — we reconnect automatically, nothing is lost.