Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Selecting the intended resource

When one request asks for scopes that belong to different APIs, the photo service cannot work out which API the token is for, and it should refuse rather than guess. Resource indicators let the printer name the API it will use the token at, so the server can address the token to that API and shape it for its recipient.

Naming the API

Scopes and audiences gave the photo service a second API, the sharing API at https://share.photos.example, and gave the printer a reason to use it. A server that works out the audience from the requested scopes cannot do so when one request asks for photos.read, which belongs to the photo API, and photos.share, which belongs to the sharing API, and the JWT access token profile says it should refuse such a request rather than guess. Inferring the audience has other limits as a service grows: two APIs may each want a scope called read, one scope may make sense at several APIs, and the client still has no way to say which API it meant.

scope=photos.read

Audience from
The scope
aud
https://api.photos.example

Token for the photo API

photos.read photos.share

Audience from
Cannot infer one
aud
None

Refused rather than guessed

photos.read + resource

Audience from
The resource parameter
aud
https://api.photos.example

The API the printer meant

The server can infer the audience from one API's scope, cannot infer it from scopes that belong to two APIs, and does not need to when the printer names the resource.

Resource indicators, published as RFC 8707 in February 2020, add one optional parameter to requests sent to the authorization server: resource. Its value identifies the protected resource where the client intends to use the token. In practice that is usually an API, named by its address.

In a request, scope says what kind of access the client wants and resource says where it will use it: the request-side counterparts of a token's scope and audience. Knowing the destination lets the server restrict the token's audience to that API. It also lets the server shape the token for its recipient: which format to use, which claims that API needs, whether to encrypt the token for it, and which of the granted scopes mean anything there.

Writing a resource value

A resource value must be an absolute URI, which means it includes a scheme such as https. It must not contain a fragment, the part after a #. It should not contain a query either, although the specification accepts that a few APIs use a query parameter as part of their identity.

The value identifies the API. It may also be the address where the API can be reached, and that is the usual choice: the client should send the most specific URI that covers the whole API it intends to use, which for most APIs is its base URI. If the sharing API lived at https://api.photos.example/sharing/ instead of on its own host, the resource value would include that path, so that it named the sharing API rather than everything on the host.

Candidate resource values for the photo API, and whether each is suitable
ValueAssessment
https://api.photos.exampleSuitable. The base URI of the photo API.
https://api.photos.example/albums/42Valid syntax, but it names one album rather than the API, so a server expecting the API's identifier will not recognize it.
api.photos.exampleNot allowed. Without a scheme, it is not an absolute URI.
https://api.photos.example#photosNot allowed. It contains a fragment.
https://api.photos.example?version=2Discouraged. A query belongs only when it is part of how the API is identified.

The client takes the value from the API's documentation or its own configuration and sends it exactly. https://api.photos.example and https://api.photos.example/ are different strings, and a server that compares values exactly will treat them as different resources.

In the authorization request

All domains, codes, and credentials in these examples are fictional. The printer's familiar authorization request from The authorization request gains one line:

https://auth.photos.example/authorize
  ?response_type=code
  &client_id=photo-printer
  &redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback
  &scope=photos.read
  &resource=https%3A%2F%2Fapi.photos.example
  &state=demo-attempt-7
  &code_challenge=qd-75t-gnweZAhIl6REjxxgFnPXGwvqYcxq3vlsaJYQ
  &code_challenge_method=S256

The value is URL-encoded because it sits inside another URL. In the authorization code flow, a resource named here applies to the whole authorization, not to one token. It describes where the access Ava approves will be used, and the server can use it to tell her which service the printer will access, to refuse a resource it does not recognize, and to remember which resources later token requests may name.

In the token request

The parameter also works in token requests, whatever the grant type. There it names where the token being requested will be used. The printer's code exchange adds the same value and authenticates with a signed client assertion, as it has since its registration switched to private_key_jwt in Building a request object. The assertion is shortened here for display:

POST /token HTTP/1.1
Host: auth.photos.example
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
&code=demo-code-7
&redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback
&code_verifier=btl_training_verifier_for_one_attempt_only_2026
&resource=https%3A%2F%2Fapi.photos.example
&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer
&client_assertion=eyJhbGciOiJFUzI1NiIsImtpZCI6InByaW50ZXItMjAyNi0xMCIsInR5cCI6IkpXVCJ9...

The access token that comes back is the one Token formats and validation decoded, with "aud": "https://api.photos.example". The difference is how the server arrived at it: the printer asked for that audience instead of leaving the server to infer it from photos.read. For JWT access tokens, the JWT access token profile says the audience should be the same value as the requested resource.

Other grants work the same way. The printer's evening job from Client credentials could add resource=https%3A%2F%2Fapi.printlab.example to its token request at the print lab, so that the token names the lab's API.

A client can also leave the parameter out. The server may then treat the request as being for no particular resource or fall back to a default, often worked out from the scopes as the Scopes and audiences lesson described. A JWT access token always needs an audience, so a server issuing one must use a default when no resource is named. A server may instead require clients to name a resource and refuse requests that do not, with the error invalid_target. Which behavior applies is the server's policy, and its documentation tells clients what to send.

So far the printer has known the API's identifier from documentation and configuration. An API can also publish it itself, in a protected resource metadata document defined by RFC 9728, which Protected resource metadata describes.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

The printer's developer is adding the photo API to its configuration. Which resource value names the whole photo API, so the photo service will recognize it? 1 of 3

Choose one answer.

In the authorization code flow, what does a resource parameter in the authorization request apply to? 2 of 3

Choose one answer.

The photo service now requires every token request to name a resource, and the printer's back-office job still leaves it out. What happens to its next token request? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity