Skip to the content.

Opaque token = random string, meaning only known to the auth server JWT token = self-contained token, meaning readable by anyone


🔹 What is an Opaque Token?

An opaque token is just a random string.

Example:

a8f9k2n9s8df7sdf98s7df98s7df

How it works

  1. Client sends token to API
  2. API calls Auth Server: “Is this token valid?”
  3. Auth server responds with user details, expiry, scopes, etc.

Characteristics

Property Opaque Token
Human readable ❌ No
Self-contained ❌ No
Needs DB/Introspection ✅ Yes
Revocation ✅ Easy
Size Small
Performance Slower (network call)
Security Very high (nothing exposed)

🔹 What is a JWT Token?

JWT = JSON Web Token

Example (3 parts):

xxxxx.yyyyy.zzzzz

Decoded payload looks like:

{
  "sub": "12345",
  "name": "Sajid",
  "role": "ADMIN",
  "exp": 1735600000
}

How it works

  1. Client sends JWT to API
  2. API verifies signature
  3. API reads user info directly from token

Characteristics

Property JWT Token
Human readable ✅ Yes
Self-contained ✅ Yes
Needs DB/Introspection ❌ No
Revocation ❌ Hard
Size Large
Performance Fast
Security Depends on design

🔥 Key Architectural Difference

Question Opaque JWT
Where is user data stored? Auth server DB Inside token
API dependency on auth server High None
Good for microservices? ❌ No ✅ Yes
Can revoke immediately? ✅ Yes ❌ No
Stateless API? ❌ No ✅ Yes

🧠 When to Use What?

Use Opaque Token when:

Use JWT when:


⚠️ Real Problem with JWT (very important)

If JWT is valid for 1 hour and user is blocked now…

👉 JWT will still work for 1 hour (because no introspection)

This is the biggest drawback.

Solution in real systems:


🏆 What Big Companies Do?

They use:

JWT access token + Opaque refresh token

Best of both worlds.


One-line Summary

Opaque = “Trust the auth server” JWT = “Trust the token itself”