<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Topics tagged with token-exchange]]></title><description><![CDATA[A list of topics that have been tagged with token-exchange]]></description><link>https://fusionauth.io/community/forum/tags/token-exchange</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 02:22:08 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/tags/token-exchange.rss" rel="self" type="application/rss+xml"/><pubDate>Invalid Date</pubDate><ttl>60</ttl><item><title><![CDATA[How to handle token audience changes when an AI agent acts on behalf of a user?]]></title><description><![CDATA[<p dir="auto">OAuth 2.0 Token Exchange (RFC 8693) is indeed designed for this kind of scenario. It allows you to exchange an existing token (the user's web-audience token) for a new token with a different audience (e.g. mcp) while maintaining the user's identity and authorization context.</p>
<p dir="auto"><strong>Important Note:</strong> FusionAuth does <strong>not currently implement RFC 8693 (OAuth 2.0 Token Exchange)</strong> natively. There is an <a href="https://github.com/FusionAuth/fusionauth-issues/issues/1471" rel="nofollow ugc">open GitHub issue</a> tracking this feature request. However, FusionAuth provides alternative approaches to achieve similar outcomes.</p>
How Token Exchange Works (RFC 8693 Concept)

<strong>User authenticates</strong> and receives a token with audience: web.
<strong>AI agent receives a request</strong> from the user via the chat interface.
<strong>Agent exchanges the token</strong>: The agent (or a backend service acting on its behalf) calls the token exchange endpoint, providing:

The original web-audience token as the subject_token
The desired new audience (mcp) in the audience parameter
Optionally, a narrower set of scopes if the downstream service requires fewer permissions


<strong>New token issued</strong>: The authorization server returns a new token with audience: mcp, tied to the same user identity.
<strong>Agent calls downstream service</strong> using the new token.

Example Token Exchange Request
POST /oauth2/token
Content-Type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&amp;subject_token=&lt;user-web-token&gt;
&amp;subject_token_type=urn:ietf:params:oauth:token-type:access_token
&amp;audience=mcp
&amp;scope=mcp:read mcp:write

Current Alternatives in FusionAuth
<p dir="auto">Since RFC 8693 isn't supported yet, here are the recommended approaches:</p>
1. Issue a JWT API
<p dir="auto">Use the <a href="https://fusionauth.io/docs/apis/jwt/issue-a-jwt" rel="nofollow ugc">Issue a JWT endpoint</a> to exchange a token from one application for a token for another application. This is FusionAuth's implementation of SSO for access tokens:</p>
GET /api/jwt/issue?applicationId={targetApplicationId}
Authorization: Bearer &lt;existing_access_token&gt;

<p dir="auto">This returns a new JWT with the target application's audience, preserving the user's identity. The user must be registered in both applications.</p>
2. JWT Populate Lambda
<p dir="auto">Use a <a href="https://fusionauth.io/docs/extend/code/lambdas/jwt-populate" rel="nofollow ugc">JWT Populate Lambda</a> to customize the aud claim directly. You can add multiple audiences to avoid token swapping:</p>
function populate(jwt, user, registration) {
  // Add multiple audiences
  jwt.aud = ['web', 'mcp', 'https://api.example.com'];
}

3. Vend a JWT API
<p dir="auto">For more complex delegation scenarios, use the <a href="https://fusionauth.io/docs/apis/jwt/vend-a-jwt" rel="nofollow ugc">Vend a JWT endpoint</a> to create a custom JWT with free-form claims (except reserved claims like iat, exp, amr, and cnf).</p>
Key Considerations

<strong>Authorization</strong>: The agent should be a registered OAuth client with permission to perform token exchanges. You may want to restrict which clients can exchange tokens and for which audiences.
<strong>Scope narrowing</strong>: The new token can have a subset of the original token's scopes, ensuring least-privilege access to the downstream service.
<strong>User consent</strong>: Depending on your security requirements, you may want to prompt the user to authorize the agent's access to the downstream service the first time this exchange happens.
<strong>Application registration</strong>: When using the Issue JWT approach, ensure the user is registered in both the source and target applications.

<p dir="auto">This approach avoids re-authentication and cleanly separates concerns: the user holds their web token, and the agent dynamically obtains the correct token for each downstream service it needs to call.</p>
Related Documentation

<a href="https://fusionauth.io/articles/oauth/complete-list-oauth-grants#oauth-20-token-exchange-grant" rel="nofollow ugc">OAuth 2.0 Grant Types - Token Exchange Grant</a> - Overview of RFC 8693 token exchange
<a href="https://fusionauth.io/docs/apis/jwt/issue-a-jwt" rel="nofollow ugc">Issue a JWT API</a> - Exchange tokens between applications (FusionAuth's current solution)
<a href="https://fusionauth.io/docs/apis/jwt/vend-a-jwt" rel="nofollow ugc">Vend a JWT API</a> - Create custom JWTs for complex scenarios
<a href="https://fusionauth.io/docs/extend/code/lambdas/jwt-populate" rel="nofollow ugc">JWT Populate Lambda</a> - Customize JWT claims including audience
<a href="https://github.com/FusionAuth/fusionauth-issues/issues/1471" rel="nofollow ugc">GitHub Issue #1471</a> - Track RFC 8693 implementation progress

]]></description><link>https://fusionauth.io/community/forum/topic/3169/how-to-handle-token-audience-changes-when-an-ai-agent-acts-on-behalf-of-a-user</link><guid isPermaLink="true">https://fusionauth.io/community/forum/topic/3169/how-to-handle-token-audience-changes-when-an-ai-agent-acts-on-behalf-of-a-user</guid><dc:creator><![CDATA[FASupportBot]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Does FusionAuth support RFC 8693 token exchange for impersonation use cases?]]></title><description><![CDATA[<p dir="auto">Based on my research of the FusionAuth documentation, I need to provide an important correction to the draft answer. FusionAuth does <strong>not</strong> currently support RFC 8693 token exchange natively. Here's the improved answer:</p>

Answer
<p dir="auto"><strong>Important Clarification:</strong> FusionAuth does <strong>not</strong> currently support RFC 8693 token exchange natively. The draft answer contains inaccurate information that needs correction.</p>
<p dir="auto"><strong>Current RFC 8693 Status:</strong></p>

Native RFC 8693 token exchange is <strong>not implemented</strong> in FusionAuth
There is an <a href="https://github.com/FusionAuth/fusionauth-issues/issues/1471" rel="nofollow ugc">open GitHub issue (#1471)</a> tracking this feature request for implementing impersonation and delegation tokens according to RFC 8693
No confirmed ETA is available for this feature

<p dir="auto"><strong>Workarounds for Token Exchange and Impersonation:</strong></p>
<p dir="auto">While native RFC 8693 support is unavailable, FusionAuth offers alternative approaches:</p>
1. Vend JWT API for Delegation
<p dir="auto">You can use FusionAuth's <a href="https://fusionauth.io/docs/apis/jwt/vend-a-jwt" rel="nofollow ugc">Vend a JWT endpoint</a> to create custom tokens that include an act claim, following RFC 8693 delegation chain semantics:</p>
const response = await client.vendJWT({
  keyId: 'your-signing-key-id',
  timeToLiveInSeconds: 300,
  claims: {
    sub: 'coordinator-agent-entity-id',
    act: {
      sub: 'original-human-user-id'
    },
    permissions: ['read:documents']
  }
});

<p dir="auto">This approach provides delegation semantics where the original actor is tracked in the act claim.</p>
2. Impersonation Implementation
<p dir="auto">For pure impersonation (without delegation tracking), you can implement this at the API level:</p>

Create a backend endpoint (e.g., /api/impersonate/{id}) that verifies the requesting user is an admin
Use the <a href="https://fusionauth.io/docs/apis/jwt/vend-a-jwt" rel="nofollow ugc">Vend JWT API</a> to directly construct a token for the target user
Manage the impersonated session in your application

<p dir="auto"><strong>Note:</strong> Impersonation via the OAuth/OIDC workflow is not supported as it would conflict with the OAuth specification.</p>
3. Other Alternatives

Consolidate services under a single application registration
Alter the aud claim via a JWT lambda
Pass two separate JWTs in different headers (one for the service, one for the user)

<p dir="auto"><strong>Recommendation:</strong><br />
If standards-compliant RFC 8693 token exchange is a hard requirement for your migration, you may want to track or upvote the GitHub issue mentioned above. For immediate needs, evaluate whether the Vend JWT API workaround meets your delegation or impersonation requirements.</p>
Related Documentation

<a href="https://fusionauth.io/docs/apis/jwt/vend-a-jwt" rel="nofollow ugc">Vend a JWT API</a> - API for creating custom JWTs with specified claims
<a href="https://fusionauth.io/articles/oauth/complete-list-oauth-grants#oauth-20-token-exchange-grant" rel="nofollow ugc">OAuth 2.0 Grant Types - Token Exchange Grant</a> - Overview of RFC 8693 token exchange concept
<a href="https://github.com/FusionAuth/fusionauth-issues/issues/1471" rel="nofollow ugc">GitHub Issue #1471: Implement Impersonation and Delegation Tokens (RFC 8693)</a> - Open feature request
<a href="https://fusionauth.io/community/forum/topic/71/does-fusionauth-have-an-impersonation-feature">Forum: Does Fusionauth have an "impersonation" feature?</a> - Community discussion on impersonation approaches
<a href="https://fusionauth.io/community/forum/topic/2878/does-fusionauth-support-uma-grant-and-token-exchange-rfc-8693">Forum: Does FusionAuth Support UMA Grant and Token Exchange (RFC 8693)?</a> - Related community discussion

]]></description><link>https://fusionauth.io/community/forum/topic/3162/does-fusionauth-support-rfc-8693-token-exchange-for-impersonation-use-cases</link><guid isPermaLink="true">https://fusionauth.io/community/forum/topic/3162/does-fusionauth-support-rfc-8693-token-exchange-for-impersonation-use-cases</guid><dc:creator><![CDATA[FASupportBot]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>