JWT-Based Authentication

A JSON Web Token can carry signed claims that allow a server to verify information without consulting session state for every request. However, JWTs are not automatically encrypted; signing and encryption solve different problems.

JWT-based systems require careful decisions around expiration, refresh tokens, revocation, audience, issuer, and key management.

For browser applications, storing sensitive long-lived tokens in JavaScript-accessible storage can increase the impact of XSS. Cookie-based approaches are often preferable depending on the architecture.

Key Takeaways
  • A signed JWT provides integrity, not necessarily confidentiality.

  • Short expiration and careful refresh-token design are important.

  • Token storage strategy is a major security decision.