<?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 audience]]></title><description><![CDATA[A list of topics that have been tagged with audience]]></description><link>https://fusionauth.io/community/forum/tags/audience</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 04:01:16 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/tags/audience.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></channel></rss>