JWT basics
A JWT has three dot-separated parts: header, payload, and signature.
The payload is readable by design, so JWT should not be treated as encrypted secret storage.
- Header: algorithm and token metadata.
- Payload: claims like subject, issuer, expiration.
- Signature: integrity verification with a key.
Where JWT helps and where it does not
JWT is useful for stateless token transport between services and clients.
It does not replace authorization logic, revocation strategy, or secure session management policies.
- Use strict claim validation in apps.
- Rotate keys and monitor token lifetime.
- Avoid storing sensitive secrets in payload.
FAQ
Is JWT encrypted by default?
No. Standard JWT is signed, not encrypted. Anyone with the token can decode header and payload.
Can I trust decoded payload right away?
No. First verify signature and then validate issuer, audience, and time-based claims.
Is JWT always better than sessions?
Not always. It depends on architecture, revocation needs, and operational constraints.