<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.29 (Ruby 3.4.4) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-mcguinness-oauth-resource-token-resp-00" category="std" consensus="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.30.0 -->
  <front>
    <title abbrev="Resource Token Response Parameter">OAuth 2.0 Resource Parameter in Access Token Response</title>
    <seriesInfo name="Internet-Draft" value="draft-mcguinness-oauth-resource-token-resp-00"/>
    <author fullname="Karl McGuinness">
      <organization>Independent</organization>
      <address>
        <email>public@karlmcguinness.com</email>
      </address>
    </author>
    <author fullname="Jared Hanson">
      <organization>Keycard Labs</organization>
      <address>
        <email>jared@keycard.ai</email>
        <uri>https://keycard.ai</uri>
      </address>
    </author>
    <date year="2025" month="July" day="23"/>
    <area>Security</area>
    <workgroup>Web Authorization Protocol</workgroup>
    <keyword>OAuth 2.0</keyword>
    <keyword>Resource Indicators</keyword>
    <keyword>Authorization Server</keyword>
    <keyword>Token Response</keyword>
    <keyword>Mix-up Attack</keyword>
    <abstract>
      <?line 46?>

<t>This specification defines a new parameter, <tt>resource</tt>, to be returned in OAuth 2.0 access token responses. It enables clients to confirm the intended protected resource (resource server) for the issued token. This mitigates ambiguity and certain classes of security vulnerabilities such as resource mix-up attacks, particularly in systems that use the Resource Indicators for OAuth 2.0 specification <xref target="RFC8707"/>.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://mcguinness.github.io/draft-mcguinness-oauth-resource-token-resp/draft-mcguinness-oauth-resource-token-resp.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-mcguinness-oauth-resource-token-resp/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        Web Authorization Protocol Working Group mailing list (<eref target="mailto:oauth@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/oauth/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/oauth/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/mcguinness/draft-mcguinness-oauth-resource-token-resp"/>.</t>
    </note>
  </front>
  <middle>
    <?line 50?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>OAuth 2.0 defines a framework in which clients request access tokens from authorization servers and present them to resource servers. In deployments where multiple resources (or APIs) are involved, the Resource Indicators for OAuth 2.0 <xref target="RFC8707"/> specification introduced a <tt>resource</tt> request parameter that allows clients to indicate the protected resource for which the token is intended.</t>
      <t>However, <xref target="RFC8707"/> does not require the authorization server to return any confirmation of the resource to which the access token applies (audience).  When an authorization request includes one or more <tt>resource</tt> parameters, the authorization server can exhibit a range of behaviors depending on its capabilities and policy configuration.</t>
      <t>An authorization server <bcp14>MAY</bcp14>:</t>
      <ul spacing="normal">
        <li>
          <t>Ignore the <tt>resource</tt> parameter (e.g., if it does not support <xref target="RFC8707"/>) and audience-restrict the issued access token to a default resource or set of resources.</t>
        </li>
        <li>
          <t>Accept and honor all requested <tt>resource</tt> values, audience-restricting the issued access token to the entire set of requested resources.</t>
        </li>
        <li>
          <t>Accept a subset of the requested <tt>resource</tt> values, audience-restricting the token accordingly.</t>
        </li>
        <li>
          <t>Override the requested <tt>resource</tt> values and issue a token audience-restricted to an authorization-server-defined set of resources, based on policy or client registration.</t>
        </li>
        <li>
          <t>Reject one or more requested <tt>resource</tt> values and return an OAuth 2.0 error response with the error code <tt>invalid_target</tt> as defined in <xref target="RFC8707"/>.</t>
        </li>
      </ul>
      <t>This leads to ambiguity in the client's interpretation of the token's audience, potentially resulting in <strong>resource mix-up attacks</strong> or incorrect token usage such as:</t>
      <ol spacing="normal" type="1"><li>
          <t>A client requests an access token for Resource A.</t>
        </li>
        <li>
          <t>The authorization server issues a token for Resource B (intentionally or due to configuration).</t>
        </li>
        <li>
          <t>The client unknowingly sends the token to Resource A, which may mistakenly accept it or return a misleading error.</t>
        </li>
        <li>
          <t>The client misuses a token for a different audience, causing a confidentiality or access control breach.</t>
        </li>
      </ol>
      <t>This document introduces a new parameter, <tt>resource</tt>, to be returned in the access token response, so the client can validate that the issued token corresponds to the intended resource.</t>
    </section>
    <section anchor="conventions-and-terminology">
      <name>Conventions and Terminology</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
      <?line -18?>

<section anchor="terminology">
        <name>Terminology</name>
        <t>The terms "client", "authorization server", "resource server', "access token", "protected resource",  "authorization request", "access token request", "access token response" is defined by the OAuth 2.0 Authorization Framework specification <xref target="RFC6749"/>.</t>
        <t>The term "resource" is defined by the Resource Indicators for OAuth 2.0 specification <xref target="RFC8707"/>.</t>
        <t>The term "StringOrURI" is defined by the JWT specification <xref target="RFC7519"/>.</t>
      </section>
    </section>
    <section anchor="resource-parameter-in-token-response">
      <name>Resource Parameter in Token Response</name>
      <section anchor="syntax">
        <name>Syntax</name>
        <t>Authorization servers that support this specification <bcp14>SHOULD</bcp14> include the <tt>resource</tt> parameter in successful access token responses, as defined in Section 5.1 of <xref target="RFC6749"/> for a valid token request.</t>
        <t>The value of the <tt>resource</tt> parameter <bcp14>MUST</bcp14> be an array of case-sensitive strings, each containing a StringOrURI value that identifies the protected resource for which the token is valid.  In the special case when the token is targeted to a single resource, the <tt>resource</tt> value <bcp14>MAY</bcp14> be a single case-sensitive string containing a StringOrURI value.</t>
        <artwork><![CDATA[
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
  "access_token": "2YotnFZFEjr1zCsicMWpAA",
  "token_type": "Bearer",
  "expires_in": 3600,
  "resource": "https://api.example.com/"
}
]]></artwork>
      </section>
      <section anchor="semantics">
        <name>Semantics</name>
        <ul spacing="normal">
          <li>
            <t>If the client included one or more <tt>resource</tt> parameters in the request per <xref target="RFC8707"/>, the <tt>resource</tt> value in the response <bcp14>MUST</bcp14> reflect the accepted or selected resource(s).</t>
          </li>
          <li>
            <t>If the authorization server selected a default resource, it <bcp14>SHOULD</bcp14> return that selected resource in the <tt>resource</tt> parameter.</t>
          </li>
          <li>
            <t>If the requested <tt>resource</tt> is not valid for the client, user, or authorization server, then the authorization server <bcp14>SHOULD</bcp14> return an <tt>invalid_target</tt> OAuth error response code according to <xref target="RFC8707"/></t>
          </li>
          <li>
            <t>If the token is not bound to a specific resource or the concept does not apply, the <tt>resource</tt> parameter <bcp14>SHOULD</bcp14> be omitted.</t>
          </li>
        </ul>
      </section>
    </section>
    <section anchor="client-processing">
      <name>Client Processing</name>
      <t>Clients that support this extension:</t>
      <ul spacing="normal">
        <li>
          <t><bcp14>SHOULD</bcp14> compare the returned <tt>resource</tt> URIs against the originally requested <tt>resource</tt> URI(s), if applicable.</t>
        </li>
        <li>
          <t><bcp14>MUST</bcp14> treat mismatches as errors, unless the client is explicitly designed to handle token audience negotiation.</t>
        </li>
        <li>
          <t><bcp14>MUST NOT</bcp14> use the token with a resource other than the one identified in the response.</t>
        </li>
      </ul>
      <section anchor="examples">
        <name>Examples</name>
        <section anchor="single-protected-resource">
          <name>Single Protected Resource</name>
          <section anchor="authorization-request">
            <name>Authorization Request</name>
            <t>Client makes an authorization request for a protected resource using the URL as the resource indicator</t>
            <artwork><![CDATA[
GET /authorize?response_type=code
  &client_id=client123
  &redirect_uri=https%3A%2F%2Fclient.example%2Fcallback
  &scope=resource%3Aread
  &state=abc123
  &resource=https%3A%2F%2Fresource.example.com%2F
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
HTTP/1.1
Host: authorization-server.example.com
]]></artwork>
          </section>
          <section anchor="redirect">
            <name>Redirect</name>
            <t>User successfully authenticates and delegates access to the client for the requested resource and scopes</t>
            <artwork><![CDATA[
HTTP/1.1 302 Found
Location: https://client.example/callback?code=SplxlOBeZQQYbYS6WxSbIA&state=abc123
]]></artwork>
          </section>
          <section anchor="token-request">
            <name>Token Request</name>
            <artwork><![CDATA[
POST /token HTTP/1.1
Host: authorization-server.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&
code=SplxlOBeZQQYbYS6WxSbIA&
redirect_uri=https%3A%2F%2Fclient.example%2Fcallback&
client_id=client123&
code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
]]></artwork>
          </section>
          <section anchor="token-response">
            <name>Token Response</name>
            <t>Resource is confirmed and unambiguous.</t>
            <artwork><![CDATA[
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "resource:read",
  "resource": "https://resource.example.com/"
}
]]></artwork>
          </section>
        </section>
        <section anchor="multiple-protected-resources">
          <name>Multiple Protected Resources</name>
          <section anchor="authorization-request-1">
            <name>Authorization Request</name>
            <t>Client makes an authorization request for multiple protected resources using the URLs as the resource indicators</t>
            <artwork><![CDATA[
GET /authorize?response_type=code
  &client_id=client123
  &redirect_uri=https%3A%2F%2Fclient.example%2Fcallback
  &scope=resource%3Aread
  &state=abc123
  &resource=https%3A%2F%2FresourceA.example.com%2F
  &resource=https%3A%2F%2FresourceB.example.com%2F
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
HTTP/1.1
Host: authorization-server.example.com
]]></artwork>
          </section>
          <section anchor="redirect-1">
            <name>Redirect</name>
            <t>User successfully authenticates and delegates access to the client for the requested resource and scopes</t>
            <artwork><![CDATA[
HTTP/1.1 302 Found
Location: https://client.example/callback?code=SplxlOBeZQQYbYS6WxSbIA&state=abc123
]]></artwork>
          </section>
          <section anchor="token-request-1">
            <name>Token Request</name>
            <t>Client exchanges the authorization code for an access token</t>
            <artwork><![CDATA[
POST /token HTTP/1.1
Host: authorization-server.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&
code=SplxlOBeZQQYbYS6WxSbIA&
redirect_uri=https%3A%2F%2Fclient.example%2Fcallback&
client_id=client123&
code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
]]></artwork>
          </section>
          <section anchor="token-response-1">
            <name>Token Response</name>
            <t>Both resources are confirmed and unambiguous.</t>
            <artwork><![CDATA[
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "resource:read",
  "resource": [
    "https://resourceA.example.com/",
    "https://resourceB.example.com/"
  ]
}
]]></artwork>
          </section>
        </section>
        <section anchor="default-resource">
          <name>Default Resource</name>
          <section anchor="authorization-request-2">
            <name>Authorization Request</name>
            <t>Client makes an authorization request  without a <tt>resource</tt> indicator</t>
            <artwork><![CDATA[
GET /authorize?response_type=code
  &client_id=client123
  &redirect_uri=https%3A%2F%2Fclient.example%2Fcallback
  &scope=resource%3Aread
  &state=abc123
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
HTTP/1.1
Host: authorization-server.example.com
]]></artwork>
          </section>
          <section anchor="redirect-2">
            <name>Redirect</name>
            <t>User successfully authenticates and delegates access to the client for the requested scopes</t>
            <artwork><![CDATA[
HTTP/1.1 302 Found
Location: https://client.example/callback?code=SplxlOBeZQQYbYS6WxSbIA&state=abc123
]]></artwork>
          </section>
          <section anchor="token-request-2">
            <name>Token Request</name>
            <artwork><![CDATA[
POST /token HTTP/1.1
Host: authorization-server.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&
code=SplxlOBeZQQYbYS6WxSbIA&
redirect_uri=https%3A%2F%2Fclient.example%2Fcallback&
client_id=client123&
code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
]]></artwork>
          </section>
          <section anchor="token-response-2">
            <name>Token Response</name>
            <t>Default resource is confirmed and unambiguous.</t>
            <artwork><![CDATA[
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "resource:read",
  "resource": "https://resource.example.com/"
}
]]></artwork>
          </section>
        </section>
        <section anchor="invalid-resource">
          <name>Invalid Resource</name>
          <section anchor="authorization-request-3">
            <name>Authorization Request</name>
            <artwork><![CDATA[
GET /authorize?response_type=code
  &client_id=client123
  &redirect_uri=https%3A%2F%2Fclient.example%2Fcallback
  &scope=resource%3Aread
  &state=invalid123
  &resource=https%3A%2F%2Fevil.example.net%2F
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
HTTP/1.1
Host: authorization-server.example.com
]]></artwork>
          </section>
          <section anchor="error-redirect">
            <name>Error Redirect</name>
            <t>The server rejected the requested resource value (e.g authorization or policy violation, resource is not valid, etc).</t>
            <artwork><![CDATA[
  HTTP/1.1 302 Found
  Location: https://client.example/callback?error=invalid_target&error_description=Resource%20not%20allowed&state=invalid123
]]></artwork>
          </section>
        </section>
      </section>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>The lack of confirmation about the audience of an access token introduces a security risk in OAuth deployments, particularly when:</t>
      <ul spacing="normal">
        <li>
          <t>A client uses multiple authorization servers and resource servers</t>
        </li>
        <li>
          <t>A client dynamically discovers an authorization server and attempts to obtain an access token at runtime via a HTTP authorization challenge with OAuth 2.0 Protected Resource Metadata <xref target="RFC9728"/></t>
        </li>
        <li>
          <t>An attacker attempts a <strong>mix-up attack</strong> where a token intended for one resource is used at another;</t>
        </li>
        <li>
          <t>The authorization server ignores or overrides the requested resource without informing the client.</t>
        </li>
      </ul>
      <t>This specification addresses such issues by explicitly returning the resource URI in the token response, similar in spirit to the <tt>iss</tt> parameter defined in <xref target="RFC9207"/>.</t>
      <t>Clients are advised to:</t>
      <ul spacing="normal">
        <li>
          <t>Validate the <tt>resource</tt> parameter when present;</t>
        </li>
        <li>
          <t>Avoid use of access tokens with unverified or unintended resources;</t>
        </li>
        <li>
          <t>Treat absence of the <tt>resource</tt> parameter as a potential ambiguity if the client requires strict audience binding.</t>
        </li>
      </ul>
    </section>
    <section anchor="privacy-considerations">
      <name>Privacy Considerations</name>
      <t>Returning the <tt>resource</tt> value may reveal some information about the protected resource. If the value is sensitive, the authorization server <bcp14>SHOULD</bcp14> assess whether the resource name can be safely disclosed to the client.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document registers the following value in the OAuth Parameters registry established by <xref target="RFC6749"/>.</t>
      <section anchor="oauth-access-token-response-parameters-registry">
        <name>OAuth Access Token Response Parameters Registry</name>
        <table>
          <thead>
            <tr>
              <th align="left">Name</th>
              <th align="left">Description</th>
              <th align="left">Specification</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">resource</td>
              <td align="left">Resource to which the access token applies</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
        </table>
      </section>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC6749" target="https://www.rfc-editor.org/info/rfc6749" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6749.xml">
        <front>
          <title>The OAuth 2.0 Authorization Framework</title>
          <author fullname="D. Hardt" initials="D." role="editor" surname="Hardt"/>
          <date month="October" year="2012"/>
          <abstract>
            <t>The OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the HTTP service, or by allowing the third-party application to obtain access on its own behalf. This specification replaces and obsoletes the OAuth 1.0 protocol described in RFC 5849. [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="6749"/>
        <seriesInfo name="DOI" value="10.17487/RFC6749"/>
      </reference>
      <reference anchor="RFC8707" target="https://www.rfc-editor.org/info/rfc8707" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8707.xml">
        <front>
          <title>Resource Indicators for OAuth 2.0</title>
          <author fullname="B. Campbell" initials="B." surname="Campbell"/>
          <author fullname="J. Bradley" initials="J." surname="Bradley"/>
          <author fullname="H. Tschofenig" initials="H." surname="Tschofenig"/>
          <date month="February" year="2020"/>
          <abstract>
            <t>This document specifies an extension to the OAuth 2.0 Authorization Framework defining request parameters that enable a client to explicitly signal to an authorization server about the identity of the protected resource(s) to which it is requesting access.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8707"/>
        <seriesInfo name="DOI" value="10.17487/RFC8707"/>
      </reference>
      <reference anchor="RFC9728" target="https://www.rfc-editor.org/info/rfc9728" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9728.xml">
        <front>
          <title>OAuth 2.0 Protected Resource Metadata</title>
          <author fullname="M.B. Jones" initials="M.B." surname="Jones"/>
          <author fullname="P. Hunt" initials="P." surname="Hunt"/>
          <author fullname="A. Parecki" initials="A." surname="Parecki"/>
          <date month="April" year="2025"/>
          <abstract>
            <t>This specification defines a metadata format that an OAuth 2.0 client or authorization server can use to obtain the information needed to interact with an OAuth 2.0 protected resource.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9728"/>
        <seriesInfo name="DOI" value="10.17487/RFC9728"/>
      </reference>
      <reference anchor="RFC8414" target="https://www.rfc-editor.org/info/rfc8414" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8414.xml">
        <front>
          <title>OAuth 2.0 Authorization Server Metadata</title>
          <author fullname="M. Jones" initials="M." surname="Jones"/>
          <author fullname="N. Sakimura" initials="N." surname="Sakimura"/>
          <author fullname="J. Bradley" initials="J." surname="Bradley"/>
          <date month="June" year="2018"/>
          <abstract>
            <t>This specification defines a metadata format that an OAuth 2.0 client can use to obtain the information needed to interact with an OAuth 2.0 authorization server, including its endpoint locations and authorization server capabilities.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8414"/>
        <seriesInfo name="DOI" value="10.17487/RFC8414"/>
      </reference>
      <reference anchor="RFC9207" target="https://www.rfc-editor.org/info/rfc9207" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9207.xml">
        <front>
          <title>OAuth 2.0 Authorization Server Issuer Identification</title>
          <author fullname="K. Meyer zu Selhausen" initials="K." surname="Meyer zu Selhausen"/>
          <author fullname="D. Fett" initials="D." surname="Fett"/>
          <date month="March" year="2022"/>
          <abstract>
            <t>This document specifies a new parameter called iss. This parameter is used to explicitly include the issuer identifier of the authorization server in the authorization response of an OAuth authorization flow. The iss parameter serves as an effective countermeasure to "mix-up attacks".</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9207"/>
        <seriesInfo name="DOI" value="10.17487/RFC9207"/>
      </reference>
      <reference anchor="RFC3986" target="https://www.rfc-editor.org/info/rfc3986" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3986.xml">
        <front>
          <title>Uniform Resource Identifier (URI): Generic Syntax</title>
          <author fullname="T. Berners-Lee" initials="T." surname="Berners-Lee"/>
          <author fullname="R. Fielding" initials="R." surname="Fielding"/>
          <author fullname="L. Masinter" initials="L." surname="Masinter"/>
          <date month="January" year="2005"/>
          <abstract>
            <t>A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource. This specification defines the generic URI syntax and a process for resolving URI references that might be in relative form, along with guidelines and security considerations for the use of URIs on the Internet. The URI syntax defines a grammar that is a superset of all valid URIs, allowing an implementation to parse the common components of a URI reference without knowing the scheme-specific requirements of every possible identifier. This specification does not define a generative grammar for URIs; that task is performed by the individual specifications of each URI scheme. [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="66"/>
        <seriesInfo name="RFC" value="3986"/>
        <seriesInfo name="DOI" value="10.17487/RFC3986"/>
      </reference>
      <reference anchor="RFC7519" target="https://www.rfc-editor.org/info/rfc7519" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7519.xml">
        <front>
          <title>JSON Web Token (JWT)</title>
          <author fullname="M. Jones" initials="M." surname="Jones"/>
          <author fullname="J. Bradley" initials="J." surname="Bradley"/>
          <author fullname="N. Sakimura" initials="N." surname="Sakimura"/>
          <date month="May" year="2015"/>
          <abstract>
            <t>JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure, enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="7519"/>
        <seriesInfo name="DOI" value="10.17487/RFC7519"/>
      </reference>
      <reference anchor="RFC9700" target="https://www.rfc-editor.org/info/rfc9700" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9700.xml">
        <front>
          <title>Best Current Practice for OAuth 2.0 Security</title>
          <author fullname="T. Lodderstedt" initials="T." surname="Lodderstedt"/>
          <author fullname="J. Bradley" initials="J." surname="Bradley"/>
          <author fullname="A. Labunets" initials="A." surname="Labunets"/>
          <author fullname="D. Fett" initials="D." surname="Fett"/>
          <date month="January" year="2025"/>
          <abstract>
            <t>This document describes best current security practice for OAuth 2.0. It updates and extends the threat model and security advice given in RFCs 6749, 6750, and 6819 to incorporate practical experiences gathered since OAuth 2.0 was published and covers new threats relevant due to the broader application of OAuth 2.0. Further, it deprecates some modes of operation that are deemed less secure or even insecure.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="240"/>
        <seriesInfo name="RFC" value="9700"/>
        <seriesInfo name="DOI" value="10.17487/RFC9700"/>
      </reference>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>
    <?line 356?>

<section anchor="additional-examples">
      <name>Additional Examples</name>
      <section anchor="requesting-a-token-for-a-dynamically-discovered-protected-resource">
        <name>Requesting a token for a dynamically discovered protected resource</name>
        <t>The following example details the need for the <tt>resource</tt> parameter when a client dynamically discovers an authorization server and obtains an access token using <xref target="RFC9728"/> and <xref target="RFC8414"/></t>
        <t>Client attempts to access a protected a resource without a valid access token</t>
        <artwork><![CDATA[
GET /resource
Host: api.example.com
Accept: application/json
]]></artwork>
        <t>Client is challenged for authentication</t>
        <artwork><![CDATA[
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata=
  "https://api.example.com/.well-known/oauth-protected-resource"
]]></artwork>
        <t>Client fetches the resource's OAuth 2.0 Protected Resource Metadata per <xref target="RFC9728"/> to dynamically discover an authorization server that can issue an access token for the resource.</t>
        <artwork><![CDATA[
GET /.well-known/oauth-protected-resource
Host: api.example.com
Accept: application/json

HTTP/1.1 200 Ok
Content-Type: application/json

{
   "resource":
     "https://api.example.com/resource",
   "authorization_servers":
     [ "https://authorization-server.example.com/" ],
   "bearer_methods_supported":
     ["header", "body"],
   "scopes_supported":
     ["resource.read", "resource.write"],
   "resource_documentation":
     "https://api.example.com/resource_documentation.html"
 }
]]></artwork>
        <t>Client discovers the Authorization Server configuration per <xref target="RFC8414"/></t>
        <artwork><![CDATA[
GET /.well-known/oauth-authorization-server
Host: authorization-server.example.com
Accept: application/json

HTTP/1.1 200 Ok
Content-Type: application/json

{
  "issuer": "https://authorization-server.example.com/",
  "authorization_endpoint": "https://authorization-server.example.com/oauth2/authorize",
  "token_endpoint": "https://authorization-server.saas.com/oauth2/token",
  "jwks_uri": "https://authorization-server.example.com/oauth2/keys",
  "scopes_supported": [
    "resource.read", "resource.write"
  ],
  "response_types_supported": [
    "code"
  ],
  "grant_types_supported": [
    "authorization_code", "refresh_token"
  ],
  ...
}
]]></artwork>
        <t>Client makes an authorization request for the resource</t>
        <artwork><![CDATA[
GET /oauth2/authorize?response_type=code
  &client_id=client123
  &redirect_uri=https%3A%2F%2Fclient.example%2Fcallback
  &scope=resource%3Aread
  &state=abc123
  &resource=https%3A%2F%api.example.com%2Fresource
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
HTTP/1.1
Host: authorization-server.example.com
]]></artwork>
        <t>User successfully authenticates and delegates access to the client for the requested resource and scopes</t>
        <artwork><![CDATA[
HTTP/1.1 302 Found
Location: https://client.example/callback?code=SplxlOBeZQQYbYS6WxSbIA&state=abc123
]]></artwork>
        <t>Client exchanges the authorization code for an access token</t>
        <artwork><![CDATA[
POST /oauth2/token HTTP/1.1
Host: authorization-server.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&
code=SplxlOBeZQQYbYS6WxSbIA&
redirect_uri=https%3A%2F%2Fclient.example%2Fcallback&
client_id=client123&
code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
]]></artwork>
        <t>Client obtains an access token for the resource</t>
        <artwork><![CDATA[
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "resource:read",
  "resource": "https://api.example.com/resource"
}
]]></artwork>
        <t>Client verifies the requested a token explicitly bound to the discovered resource.</t>
      </section>
    </section>
    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>This proposal builds on prior work in OAuth 2.0 extensibility and security analysis, particularly <xref target="RFC8707"/>, <xref target="RFC9700"/>, and <xref target="RFC9207"/>.</t>
    </section>
    <section numbered="false" anchor="document-history">
      <name>Document History</name>
      <t>-00</t>
      <ul spacing="normal">
        <li>
          <t>Initial revision</t>
        </li>
      </ul>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA+1b63bbRpL+j6fopU8SW0ekSFrxRTuahJIlW7JlKbpE4+Tk
yA2gSbYFAhw0QIqJ/S77LPtkW1XdDTRA0JKdzG4ya50chwT6Ul2Xry5dbLfb
XiazSGyx1vEgz8as3+myU6GSPA0EO+Epn4hMpEzGbBAEQil2nlyLGIdMk1iJ
lsd9PxUzmF/Mqo4oF2l5YRK8hs8wOEz5MGtPglEu4xiWbSccdm+nZo12hmvg
12m72215Ac/EKEkXW4y1VBa2vHmSXo/SJJ/CWpfCZ0h7kspfeSaTmJ2kSZ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