Skip to content
Header & Payload
step 1/5

Reading — step 1 of 5

Read

~1 min readJWT Anatomy

Header & Payload

The header is a small JSON object specifying the algorithm:

{"alg":"HS256","typ":"JWT"}
FieldMeaning
algSigning algorithm: HS256, HS384, HS512, RS256, ES256, none
typAlways "JWT" (sometimes "JWE" for encrypted)
kidOptional key ID — lets you rotate keys

The payload is the claims — arbitrary JSON, but with reserved keys:

ClaimFull NameMeaning
ississuerWho created this token
subsubjectUser this token represents
audaudienceWho should accept this token
expexpiration timeUnix timestamp when token expires
nbfnot beforeUnix timestamp before which it's invalid
iatissued atUnix timestamp when issued
jtiJWT IDUnique token ID (for blacklisting)

You can also include arbitrary application-specific claims like username, role, permissions, etc. — but prefer keeping JWTs small since they go in every request header.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…

Header & Payload — Build a JWT Library