Header
Includes lg (algorithm) and optional yp and kid. Reject lg: none unless you are tracing an exploit.
Learn JWTs
This guide walks through the structure of a JWT, explains how to safely decode tokens with JWTSecrets, and documents the security checks you should automate in production.
JSON Web Tokens contain three Base64URL encoded segments separated by periods. The header defines metadata, the payload holds claims, and the signature ensures integrity.
Includes lg (algorithm) and optional yp and kid. Reject lg: none unless you are tracing an exploit.
Contains registered claims like iss, sub, ud, exp, bf, and any custom scopes. Treat everything as attacker-controlled.
Protects integrity using HMAC (HS256) or asymmetric algorithms (RS256, ES256). Verification requires the correct key.
You can preload a token by appending #t= followed by a Base64 encoded token to the decoder URL. The script decodes it locally on load.
After decoding the payload, confirm that claims align with your authentication policy. Use automated guards in your API and supplement with manual reviews during debugging.
Decoding is just the first step. To protect sessions end-to-end, incorporate verification, rotation, and monitoring.
No. Decoding the header and payload does not require the signing key. Verification does, which is why JWTSecrets Enterprise integrates with managed HSMs.
Avoid it when possible. Use HttpOnly cookies for session tokens to prevent XSS access, and rotate refresh tokens frequently.
For interactive logins keep expirations under 15 minutes with automatic refresh. Machine tokens should expire in minutes and rely on client credentials for reissue.