OAuth protected resource metadata: check an API's token audience and permissions
Learn what RFC 9728 publishes for an API, how to discover its metadata URL, and how to validate the resource identity before using its endpoint and scope information.
OAuth protected resource metadata: check an API's token audience and permissions
OAuth Protected Resource Metadata (RFC 9728) is a standard JSON document through which an API or other protected resource publishes its identifier, supported scopes, accepted bearer-token methods, and associated authorization-server information. Authorization-server metadata describes the endpoints that issue tokens; protected-resource metadata describes the API that receives them. Knowing the difference helps a client determine which service should receive an access token and what permissions to request.
What can the document publish?
The required resource field is the HTTPS URL identifier of the protected resource. The document may also include optional or recommended fields such as:
`authorization_servers`: issuer identifiers for authorization servers that can be used with this API
`scopes_supported`: scopes the API advertises
`bearer_methods_supported`: accepted ways to present a bearer token, such as `header`
`resource_name`, `resource_documentation`, and `resource_policy_uri`: information about the API for users or developers
`dpop_signing_alg_values_supported` and `dpop_bound_access_tokens_required`: information related to validating DPoP proofs and token binding
These fields are not all required. In particular, a scope list does not necessarily enumerate every scope the server supports. Seeing a scope in metadata is not an instruction to request it or grant it to a user. Request only the minimum permissions needed for the task.
The address and discovery method
RFC 9728's default well-known suffix is /.well-known/oauth-protected-resource. If the resource is https://api.example, the JSON document can be requested at:
resource: https://api.example
metadata: https://api.example/.well-known/oauth-protected-resourceIf the resource identifier has a path, insert the well-known path between the host and the resource path. For example, https://api.example/orders maps to https://api.example/.well-known/oauth-protected-resource/orders. An API can also point an unauthenticated client to a metadata URL through the resource_metadata parameter in a WWW-Authenticate header. This can help the client decide which authorization server to use.
This is a different document from OAuth authorization-server metadata in RFC 8414. RFC 8414 describes an issuer and authorization/token endpoints; RFC 9728 describes the API itself and the token properties it accepts. The documents can refer to each other, but they do not replace one another.
Validate the document before trusting it
**Determine the resource from a trusted source:** Use a safe source such as application configuration or a user-selected service URL. If a server fetches metadata based on arbitrary user input, it can create an SSRF risk; server-side fetchers should restrict unsafe destinations such as internal IP ranges.
**Validate HTTPS:** Check the TLS certificate when retrieving metadata and confirm it matches the host in the resource identifier.
**Match `resource`:** The returned JSON `resource` value must exactly match the protected-resource identifier used to construct the metadata URL. If it does not, do not use the document.
**Choose an authorization server:** If `authorization_servers` is present, compare its entries with a trusted issuer list. The field is optional, so its absence is not permission to choose an arbitrary authorization server; follow the service's trust policy.
**Limit the token request and presentation:** Request only the minimum scopes required by the API and present the bearer token using a method the API supports. Do not put bearer tokens in URL query strings.
**Handle updates and caching:** Follow HTTP caching guidance and account for metadata changes. If the server announces refreshed metadata in a new `WWW-Authenticate` challenge, fetch and validate the new document before using it.
A small response example
The following JSON illustrates the format. It does not claim that a real API supports this authorization server or scope.
{
"resource": "https://api.example",
"authorization_servers": ["https://auth.example"],
"scopes_supported": ["orders:read"],
"bearer_methods_supported": ["header"],
"resource_name": "Orders API"
}For example, if a client needs to read orders and sees orders:read, that is information about a possible scope, not a reason to request every listed scope. Request only what the feature needs, then verify that the issued token has https://api.example as its audience and includes the scope required by the API.
Summary
Protected resource metadata helps clients discover an OAuth API's identifier and token-related capabilities. Unlike authorization-server metadata, it describes the resource that receives tokens, not the server that issues them. Validate TLS and the exact resource value, then determine the trusted authorization server and minimum scope under separate policy.
References
[RFC 9728 — OAuth 2.0 Protected Resource Metadata](https://www.rfc-editor.org/rfc/rfc9728.html)
[RFC 8414 — OAuth 2.0 Authorization Server Metadata](https://www.rfc-editor.org/rfc/rfc8414.html)
[RFC 9700 §2.3 — Access Token Privilege Restriction](https://www.rfc-editor.org/rfc/rfc9700.html#section-2.3)
[OWASP SSRF Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)