Token Introspection and Validation
What you'll learn: How resource servers confirm that the access tokens they receive are legitimate and currently valid.
When a resource server (like your API) receives an access token from a client, it faces a crucial question: "Is this token valid right now?" There are two main approaches to answer this.
Local Token Validation
With local validation, the resource server checks the token itself without contacting the authorization server. This works best with JWTs (which we've learned about) because they're self-contained and cryptographically signed. The server:
- Verifies the signature using the authorization server's public key
- Checks the expiration time (
expclaim) - Validates the audience (
aud) and issuer (iss)
Analogy: Like checking a driver's license — you can verify its authenticity by examining security features without calling the DMV.
Pros: Fast, no network calls, scales well
Cons: Can't detect revoked tokens until they expire naturally
Token Introspection (RFC 7662)
Token introspection means the resource server asks the authorization server "Is this token still valid?" by calling a dedicated introspection endpoint. The server sends the token and receives a response like:
{
"active": true,
"scope": "read write",
"client_id": "mobile-app",
"exp": 1735689600
}
Pros: Real-time revocation detection, works with opaque (non-JWT) tokens
Cons: Network latency, additional load on authorization server, potential bottleneck
Hybrid Approach
Many systems use local validation as the primary check and cache introspection results, refreshing periodically or when suspicious activity occurs. This balances performance with security.
Key Takeaway: Resource servers validate tokens either locally (fast, limited revocation awareness) or via introspection endpoints (real-time status, network overhead) — often combining both strategies for optimal security and performance.