Course contentsShow
← System Design
Lesson 927 of 1,91924. Authentication and Authorization at ScaleFree lesson

Token Introspection and Validation

How resource servers validate tokens using introspection endpoints or local validation.

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:

  1. Verifies the signature using the authorization server's public key
  2. Checks the expiration time (exp claim)
  3. 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.