Architectural Breakdown & AnalysisFAANG Aligned
Authenticating users across independent microservices requires moving away from single-server memory sessions.
| Mechanism | How It Works | Pros | Cons |
|---|---|---|---|
| Stateful Session (Redis) | User ID is mapped to a random Session ID in Redis. Microservices call Redis to validate token per request. | Immediate revocation. High security. | Network round-trip latency to Redis on every API call. |
| Stateless JWT | User metadata and permissions are signed cryptographically and sent in client header. Services validate signatures locally using public key. | Zero network latency for validation. Highly scalable. | Hard to revoke before expiration without building token blacklists. |
| OAuth 2.0 / OIDC | Delegation framework where third-party services request access tokens issued by an identity provider (Auth0/Okta). | Industry standard separation of concerns. | Multi-step handshakes and token management complexity. |
TIP — Hybrid Edge Pattern
Deploy an API Gateway at the edge. The gateway validates the client's Session ID or JWT once, strips the token, and attaches trusted headers (e.g., X-User-ID: 8472, X-User-Role: Admin) down to internal microservices.