← Back to microservices patterns mapauth
Microservices Pattern
Token-Based Auth (JWT)
Use signed tokens to propagate identity and authorization claims.
Detailed Description
JWTs work well for stateless identity propagation.
Use short expirations, key rotation, and careful claim design.
Visual Diagram
JWT Flow
Client → POST /auth/login
AuthSvc → signs JWT { userId, roles, exp }
Client → sends JWT in Authorization header
ServiceA → verify signature locally ✓
ServiceA → extract userId, roles from payload
Stateless — no session store neededTradeoffs
Pros
Stateless validation, works across services
Cons
Revocation and claim freshness are hard
Examples: jsonwebtoken, jose, Auth0, Keycloak, Cognito
Comments
Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.
Loading comments...
On this page
0 sections