JWT Debugging: 5 Tips Every Developer Should Know
JWT (JSON Web Token) issues are among the most common authentication debugging tasks. Here are five tips to debug JWT problems faster.
1. Always Check Expiration First
The `exp` claim is the #1 cause of "suddenly stopped working" auth issues. StackSutra's JWT decoder highlights expiration status automatically.
2. Verify the Algorithm
Check the `alg` header claim. A mismatch between expected and actual algorithm causes silent verification failures.
3. Inspect Custom Claims
Beyond standard claims (sub, iat, exp), your app may use custom claims like `role`, `permissions`, or `tenant_id`. The payload panel shows all claims.
4. Don't Paste Production Tokens in Untrusted Tools
StackSutra decodes locally in your browser, making it safer than server-based decoders. Still, avoid sharing tokens in public channels.
5. Signature Verification Is Separate
Decoding shows you what's inside a token. Verifying the signature requires your secret key and should happen server-side, never in a browser tool.