When a login fails with "unauthorized", the answer is often inside the token: it has expired, it was issued for a different audience, or a role is missing. The first two of its three parts are readable once decoded.
Steps
- Open JWT decoder.
- Paste the token. You can paste a whole Authorization value: a leading Bearer is removed.
- Read the two blocks marked Header and Payload, shown as indented JSON.
- Look at the line under the result. It shows Issued when the token has an iat claim, and Expires or Expired when it has an exp claim, as dates in your time zone.
The token stays on your device
A valid access token is as good as a password until it expires. Decoding here happens in your browser and the token is not transmitted. Even so, do not paste production tokens into chats or tickets.
It decodes. It does not verify.
The tool reads the header and payload and ignores the third part, the signature. It does not ask for a secret or a public key and cannot tell you whether the token is genuine or has been altered. Anyone can write a token with any claims and it will decode. Trust must be decided by the server, with a library that checks the signature.
A JWT payload is also not secret. Whoever holds the token can read everything in it, so nothing confidential belongs there. Encrypted tokens are a different format and give the message "This is not a JWT."
Common claims
- alg in the header: the signing algorithm, for example HS256 or RS256.
- sub: the subject, usually the user ID.
- iat, nbf and exp: issued at, not valid before and expiry, as Unix seconds. For nbf or any other time value, use Unix timestamp converter. An iat of 1516239022 is 18 January 2018, 01:30:22 UTC.
To decode a single Base64 value that is not a token, use Base64 decode.