πŸ‹
Menu
How-To Beginner 1 min read 197 words

How to Debug JWT Tokens Step by Step

JWT tokens contain encoded claims that can be decoded and inspected. Learn how to decode, verify, and troubleshoot JWT authentication issues.

Key Takeaways

  • A JWT consists of three Base64URL-encoded parts separated by dots: header, payload, and signature.
  • JWT payloads are encoded, not encrypted.
  • Token expired**: The `exp` claim is in the past. Check server-client time sync.
  • Never paste production JWT tokens into online decoders β€” they contain sensitive user data.
  • JWT `exp` is a Unix timestamp in seconds.

JWT Structure

A JWT consists of three Base64URL-encoded parts separated by dots: header, payload, and signature. The header specifies the algorithm. The payload contains claims (user data, expiration, permissions). The signature verifies integrity.

Decoding Without Verification

JWT payloads are encoded, not encrypted. You can decode the header and payload without the secret key. This is useful for debugging β€” inspect the claims, check expiration times, and verify the token structure.

Common JWT Problems

  • Token expired: The exp claim is in the past. Check server-client time sync.
  • Invalid signature: The token was modified or signed with a different key.
  • Missing claims: Required fields like sub, iss, or aud are absent.
  • Wrong algorithm: The server expects RS256 but the token uses HS256.

Security Considerations

Never paste production JWT tokens into online decoders β€” they contain sensitive user data. Use client-side tools that decode tokens in the browser without sending data to any server.

Expiration Management

JWT exp is a Unix timestamp in seconds. A common mistake is using milliseconds, which makes the token expire thousands of years in the future. Always verify the timestamp format matches your JWT library's expectations.

κ΄€λ ¨ 도ꡬ

κ΄€λ ¨ 포맷

κ΄€λ ¨ κ°€μ΄λ“œ