Vaultools
Menu

JWT (JSON Web Token)

A JSON Web Token is a compact, URL-safe string that carries a set of claims as JSON, usually signed so the receiver can detect tampering. It is defined in RFC 7519 and is widely used for API and session authentication.

What a JWT looks like

A JWT is three Base64URL-encoded segments joined by dots:

header.payload.signature

Because each of the first two segments is just Base64URL-encoded JSON, anyone holding the token can read them. Nothing needs to be cracked.

Registered claims

RFC 7519 defines a handful of standard claims. All are optional, but most real tokens use several:

ClaimMeaning
issIssuer: who created the token
subSubject: who the token is about, often a user ID
audAudience: who the token is intended for
expExpiration time: the token must not be accepted after this
nbfNot before: the token must not be accepted before this
iatIssued at: when the token was created
jtiJWT ID: a unique identifier, useful for revocation lists

The three time claims are numeric dates: seconds since the Unix epoch, not milliseconds. See Unix timestamp.

Signed, not encrypted

Most JWTs in the wild are JWS tokens (RFC 7515): signed, so tamper-evident, but with a readable payload. There is also JWE (RFC 7516), which encrypts the payload, but it is much less common. If you are not sure which you have, count the segments: a signed JWT has three, and a JWE has five.

The practical rule: never put anything in a JWT payload that the token holder should not be allowed to read.

Common pitfalls

Inspecting one safely

Real tokens are credentials, so pasting one into a server-side decoder means handing that server a working key to your account. The decoder here runs in your browser and never sends the token anywhere. It reads the header, payload and expiry only, and deliberately does not verify signatures, because that would require your secret.

References

Ads on this page

Non-personalized ads help keep Vaultools free — Google decides where they appear on the page.

Go Pro to remove them →