OAuth token introspection: how a resource server checks token status
Learn what OAuth token introspection tells a resource server, how to call the endpoint safely, and why active status must be checked alongside API permissions and cache risks.
OAuth token introspection: how a resource server checks token status
OAuth token introspection is a procedure in which a resource server asks the authorization server about a token's current status and related metadata. It is especially useful when the resource server cannot interpret an opaque token or learn its latest revocation status, but it can also complement structured tokens when current authorization-server state is needed. Do not grant access based on the response alone: also check whether the token's audience and scope fit the API request.
Who queries whom?
A protected resource, such as an API server that received the token, calls the authorization server's introspection endpoint. The user's app or browser does not call this endpoint arbitrarily. The authorization server checks applicable facts such as whether it issued the token, whether it is expired or revoked, and whether the requesting resource may use it, then returns JSON.
An opaque token does not reveal its expiration or scope to the resource server. Introspection returns information the server can validate. A self-contained token such as a JWT can also be introspected when the deployment needs current revocation state or a central policy check. If local validation is sufficient and a network call on every request is unnecessary, weigh the benefit against operational cost.
Request and response basics
RFC 7662 defines an introspection request as an HTTPS-protected HTTP POST with the token in an application/x-www-form-urlencoded body. The calling resource server must authenticate to access the endpoint. token_type_hint is optional; even if a token is not found using the hinted type, the authorization server must search all supported token types.
POST /introspect HTTP/1.1
Host: auth.example
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <example resource-server introspection credentials>
token=<token_to_check>&token_type_hint=access_tokenThe address and values are illustrative. Confirm the actual endpoint, client-authentication method and supported parameters in the provider's documentation. Do not place tokens or caller credentials in URLs, browser code, logs or diagnostic tickets.
A successful response may include active and optional metadata, for example:
{
"active": true,
"scope": "orders:read",
"client_id": "example-client",
"aud": "orders-api",
"exp": 1795000000
}This JSON is also illustrative. Many RFC 7662 fields are optional, and each authorization server decides what it returns. The RFC leaves the precise meaning of active to the authorization server. It commonly means that the token was issued, has not expired or been revoked, and is usable by the querying protected resource.
A query for an invalid or inactive token commonly returns 200 OK with active: false, rather than an HTTP error. active: true does not mean the current request should automatically be allowed. The resource server still checks the API audience, required scope, user/client status and application permissions. An inactive response should not reveal a reason or other token details.
Applying the result at the resource server
Extract the access token from the request and check that its delivery method follows the deployment policy.
Find the introspection endpoint and client-authentication method in trusted authorization-server documentation or metadata.
Use HTTPS for server-to-server calls and verify the certificate and hostname. POST with credentials authorized to call the endpoint.
Distinguish network failures, malformed responses, caller-credential errors and `active: false`. Do not allow a request when validation is unavailable; return a safe failure and raise an operational alert.
Even when `active` is true, verify the API audience, required scope, user/client status and resource-specific permissions.
If caching for performance, decide how much revocation delay is acceptable. Check that the cache does not violate any requirement for immediate revocation.
Caching can reduce network cost and latency, but a revoked token may appear valid until the cache expires. RFC 7662 prohibits caching a response beyond its exp value when present and discusses choosing a lifetime based on acceptable revocation delay and request risk. For a high-risk resource, assess whether it can handle the extra network load if caching is disabled. Without caching, plan for authorization-server outages, bounded retries and failure handling. Introspection responses may include personal data such as user identifiers: request and retain only information needed for the authorization decision, and prevent exposure to unintended services or logs.
Operations checklist
| Check | What to confirm |
|---|---|
| Endpoint trust | Use the endpoint published by the authorization server and validate its TLS certificate. |
| Caller access | Authenticate the introspection caller and restrict its permission. Do not permit token-guessing queries. |
| Data minimization | Use returned scopes and identifiers only as needed; do not log sensitive responses. |
| Inactive result | Do not serve the protected resource when active: false. Usually do not expose detailed invalid-token reasons. |
| Authorization | Check API audience, scope and actual resource permissions in addition to active. |
| Cache and revocation | Confirm cache lifetime and revocation propagation delay meet security needs. |
| Outage handling | Fail safely on endpoint timeouts/errors and prepare alerts and recovery procedures. |
Summary
Introspection is the OAuth standard method for a protected resource to ask the authorization server for a token's current status and related metadata. Treat both the endpoint call and token as sensitive, and do not approve API access based only on active. Check audience, scope and resource permissions, and account for revocation delay from caching and authorization-server outages.
References
[RFC 7662 — OAuth 2.0 Token Introspection](https://www.rfc-editor.org/rfc/rfc7662.html)
[RFC 7009 — OAuth 2.0 Token Revocation](https://www.rfc-editor.org/rfc/rfc7009.html)
[RFC 9700 §2.3 — Access Token Privilege Restriction](https://www.rfc-editor.org/rfc/rfc9700.html#section-2.3)