If you’re building apps that interact with multiple APIs using OAuth 2.0, you’ve probably wondered:
How does the authorization server know which resource server the client wants to access?
That’s where RFC 8707 comes in. It's a simple but powerful addition to OAuth 2.0 that lets clients explicitly tell the authorization server which specific resource they want to access.
This might sound minor, but it solves key security and usability challenges in modern multi-API environments.
In classic OAuth 2.0, when a client requests an access token, the authorization server doesn't know where that token will be used. Consider this scenario:
The question: Which API is this token for? All of them? Just one?
Without knowing the intended destination, the authorization server faces several problems:
In short: The client knows where it’s going, but the authorization server doesn’t.
RFC 8707 introduces a new resource parameter that clients include in OAuth requests:
This tells the authorization server: "I want a token specifically for the Photos API."
Say a client wants to access the Photos API
The authorization server issues a token that:
Guideline: Use the most specific URI for the complete API or set of resources you intend to access. Examples:
Guideline: Prefer requesting a single resource per token.
Why: Multiple audiences create security risks: if the Photos API gets your token, it could potentially use it to access the Videos API too.
In multi-tenant systems, tokens should not be valid across tenants. You can scope them by embedding tenant IDs in the resource URI:
For multi-tenant systems:
Here's how this looks in a typical authorization code flow:
The token's aud claim will be https://api.photos.example.com, making it useless anywhere else.
If the authorization server doesn’t recognize or support the requested resource, it may return: Error: invalid_target
Response:
Make sure your client handles this gracefully.
Think of RFC 8707 as adding a “destination address” to OAuth tokens. It’s a small addition, but it makes a big difference when you're dealing with complex, multi-API ecosystems and want your tokens to be precise, secure, and reliable.
If your authorization server supports it, start using the resource parameter today.