05 / 06

Why JWT may be the wrong choice?

JWT may be the wrong choice for applications requiring instant token revocation, large payloads, or when you need server-side session control and auditability.

JWT is stateless and self-contained, which provides scalability but introduces several drawbacks. It may be the wrong choice when you need immediate token revocation (e.g., user logout, role change). Without a central store, compromised tokens remain valid until expiration. JWT payloads can become large, increasing network overhead. Additionally, auditing user sessions is difficult because the server has no record of issued tokens. For applications with strict security requirements (e.g., banking, healthcare) or those requiring real-time user session visibility, traditional server-side sessions with cookies may be more appropriate.

When JWT is not recommended
  1. 1

    Need instant revocation: JWT cannot be invalidated without a blacklist (which adds state).

  2. 2

    Large payloads: Embedding permissions or user data increases token size, impacting bandwidth.

  3. 3

    Session audit requirements: Stateless nature means you don't know which tokens are active.

  4. 4

    Short-lived sessions: Frequent token refreshes add complexity compared to session cookies.

  5. 5

    Legacy systems: Existing infrastructure may rely on session-based authentication.