Problem
Forwarding the user's original access token to every downstream service lets any compromised service replay it broadly. Using a shared service credential instead loses the identity of the end user.
Also known as: rfc-8693, on-behalf-of-flow, token-downscoping
Swap an incoming token for a new one scoped to a specific downstream audience, preserving user context with minimal privilege.
Forwarding the user's original access token to every downstream service lets any compromised service replay it broadly. Using a shared service credential instead loses the identity of the end user.
Token exchange lets a service ask the identity provider for a different token than the one it holds. It supports delegation (acting for a user) and impersonation, and is the standard answer to the confused deputy problem in microservice chains.
Many deployments use a gateway or mesh component as the exchanger so that application teams do not implement the grant themselves. Keep an allow-list of exchange rules as reviewable configuration, and log each exchange with subject, actor, audience and scopes to make investigations straightforward.
Client -> API Gateway: access token T1 (aud=gateway, scope=orders:rw)
Gateway -> STS: POST /token
grant_type=urn:ietf:params:oauth:grant-type:token-exchange
subject_token=T1 audience=billing scope=invoices:read
(authenticated as gateway client)
STS: policy(gateway may exchange for billing, read only)? yes
STS -> Gateway: T2 (aud=billing, sub=user, act=gateway, exp=2m)
Gateway -> Billing: T2
Each hop can exchange again, appending to the act chain for end-to-end traceability.
Medium — capable IdP
Medium — exchange policies
High
Overly permissive exchange policy allows privilege escalation
Authorization server outage stalls all internal calls
Actor chain not validated, enabling confused deputy