Decoded
Re-parsed whenever the input changesHeader
First part · describes the token itself{
"alg": "HS256",
"typ": "JWT"
}Symmetric signing: one key for both signing and verifying (32+ bytes is safer)
Payload
Second part · just base64url, not encryption{
"iss": "https://haveyb.com",
"sub": "10086",
"aud": "haveyb-web",
"name": "张三",
"admin": true,
"iat": 1789782510,
"nbf": 1789782510,
"exp": 1821318510,
"jti": "c4a7f2e1-9b3d-4a58-8f0c-7e2d1a6b5c93"
}Signature
Third part · a signature, not JSONTmLdP8JpksuOmJ1WIGC6h3D7d3eVZ38tshKc-XEbMrE
Running the algorithm from the header over the first two parts produces this string. The server recomputes it and compares — a mismatch means the content was altered. The signature itself carries no user data.
Signature matches — this signature was produced with that key
JWT is not encryption: the header and payload are only base64url encoded, anyone holding the token can decode them — keep passwords, ID numbers and keys out of the payload.
A signature prevents tampering, not disclosure: the payload travels as plaintext; the signature only proves it was not modified, it does not hide it from anyone.
Three things to configure: HTTPS everywhere, a short expiry, and server-side checks against an algalgorithm allowlist that rejects untrusted algorithms.