Why JWT Is Leaving the Browser: A Reality Check on Authentication Patterns
Major websites like Google, Meta, and Amazon avoid JWT for browser authentication, preferring Session + Cookie. This analysis reveals JWT's revocation problems, security trade-offs, and why JWT + Redis is essentially a hand-rolled session, while IETF's 2025 OAuth spec recommends BFF with HttpOnly cookies for SPAs.
Reading font

Discussions on Hacker News and Reddit suggest JWT's real-world adoption for browser authentication is far lower than its prominence in tutorials and interviews would imply. Inspecting browser developer tools on major sites — GitHub, Microsoft, Meta, Apple, Google, Amazon, Netflix, Taobao, Baidu — reveals they overwhelmingly use traditional session cookies (SID, HSID, SSID, SAPISID) rather than JWT.
JWT Is Not Useless, Just Misplaced
JWT suits scenarios where self-contained, verifiable credentials must cross untrusted boundaries: internal service-to-service calls (gateway and service mesh ecosystems support this), edge nodes requiring offline verification, and open-platform machine identities where third parties verify tokens without callbacks. It was never designed for user login in browsers.
JWT Cannot Be Revoked
When a compromised account must be logged out immediately, session-based systems delete the server-side record — instant effect. A signed JWT remains valid until expiry; the only revocation method is a server-side blocklist checked on every request, which destroys JWT's stateless claim. As the community summarizes:
JWT aims to be stateless, but once revocation is needed, it cannot be stateless.
Shortening expiry (e.g., 15 minutes) with refresh tokens shifts revocation to the refresh boundary but introduces a complex dual-token infrastructure: refresh token storage, rotation, replay detection, request queuing during refresh, and multi-tab synchronization. Chinese-language "silent refresh" post-mortems document production incidents from concurrent 401 collisions, race conditions in refresh endpoints, and cascading failures after token rotation. Session cookies achieve the same with a sliding-window timeout and one line of configuration.
95% of JWT Usage Simulates Sessions
Typical implementations issue a token containing only a userId, then query the database on every request for current roles and status — exactly what a session does, plus signature verification overhead. Session IDs are tens of bytes; JWTs often reach hundreds or thousands (one team observed 2.8 KB headers exceeding request bodies). Moreover, a JWT payload captures claims at issuance time; if an admin role is revoked two hours later, the token still grants access until expiry, whereas session-based authorization always reads live server-side data.
Security Can Be Worse
JWT payloads are Base64-encoded, not encrypted — fully visible to any same-origin JavaScript. Storage becomes a dilemma: localStorage exposes tokens to XSS theft; HttpOnly cookies mitigate XSS but reintroduce CSRF risk and SameSite configuration, making the attack surface identical to a session cookie. JWT libraries have historically suffered algorithm-confusion vulnerabilities (e.g., accepting alg: none with no signature), including incidents at Auth0, because verification logic is left to implementers. The claim that "JWT in headers is immune to CSRF" is true only if stored in localStorage, which brings back the higher-severity XSS risk; security consensus rates XSS as fundamentally more dangerous than CSRF.
JWT + Redis Is a Hand-Rolled Session
This pattern — issue token, store state in Redis, validate on every request — matches the definition of a session:
a random identifier held by the client, mapped to server-side state. The only differences are generation (custom vs. framework), storage location (explicit Redis vs. container memory), and transport (manual Authorization header vs. automatic Cookie). All session semantics — expiry, renewal, concurrent login control — must be reimplemented. It is not a session replacement; it is a session rebuilt from scratch with added complexity.
Distributed Systems Do Not Require JWT
The argument "distributed systems need JWT because sessions don't share" is outdated. Spring Session + Redis makes distributed sessions a dependency away: centralized storage, shared across nodes, horizontal scaling without friction. Conversely, JWT revocation still needs a Redis blocklist, so centralized state remains, plus signature verification and payload bloat costs. Statelessness solves "authentication center as single point," not authentication itself. Many JWT + Redis systems are hybrid architectures that JWT identifies who you are, Redis decides if you still count.
Scenario-Based Recommendations
Traditional multi-page web app : Session + Cookie — Revocable, simple, HttpOnly prevents XSS
SPA (single-page application) : BFF + HttpOnly session cookie — Token never enters browser; industry-standard direction
Mobile app : OAuth2 opaque access token — Token stored in Keychain/Keystore
Monolithic API serving multiple clients : Opaque token + Redis — Header-friendly; essentially a manual session
Microservice internal calls : JWT or mTLS — Short-lived self-contained credentials within trust boundaries
Open third-party APIs : OAuth2 access token — Unified management, revocation, scope control
IETF's 2025 finalization of "OAuth 2.0 for Browser-Based Apps" endorses the BFF (Backend for Frontend) pattern: the SPA talks only to a lightweight backend, all tokens stay server-side, and the browser receives only an HttpOnly session cookie. The standardized answer for SPAs circles back to session cookies: SPA's standardized answer is still Session Cookie.
Conclusion
The "Web" in JSON Web Token misled many into assuming it belongs in browsers; its actual browser niche is tiny. Teams that adopted JWT early — implementing dual tokens, silent refresh, blocklists — often later migrated back to server-side sessions after maintenance burden became unsustainable. Statelessness is a spectrum, not a binary; many "new paradigms" are old concepts repackaged. Technology choices should follow evidence, not hype. JWT remains a sharp tool for service-to-service credentials, offline verification, and machine identities; but for browser sessions, decades of evolution have made Session + Cookie — now backed by mature distributed solutions — the most reliable, controllable, and battle-tested answer.
For questions about attribution, corrections or content rights, please contactand we will review it promptly.