API Security & Auth ReferenceUpdated: 2026-11-05

JSON Web Tokens (JWT): Claims, Cryptographic Signatures & Security Reference

Understand header, payload, and signature segments, standard RFC 7519 claims, and common security vulnerabilities.

JSON Web Tokens (RFC 7519) are compact, URL-safe means of representing claims to be transferred between two parties. Widely used for stateless authentication in REST APIs and OAuth 2.0 / OpenID Connect flows, understanding JWT structure and signature verification is critical for preventing authentication bypasses.

The Three JWT Segments

A JWT is composed of three Base64URL-encoded strings separated by dots: `header.payload.signature`.

SegmentExample Decoded ContentCryptographic Purpose
1. Header`{"alg":"HS256","typ":"JWT"}`Specifies token type and the cryptographic signing algorithm.
2. Payload`{"sub":"123","role":"admin","exp":1730000000}`Contains user session claims and authorization attributes.
3. Signature`HMACSHA256(base64Url(header) + "." + base64Url(payload), secret)`Guarantees the token was not tampered with in transit.

Standard Registered Claims (RFC 7519)

Reserved claim keys recommended for standard interoperability.

Claim KeyFull NameTypeDescription
`iss`IssuerStringIdentifies the principal that issued the token (e.g. `https://auth.example.com`).
`sub`SubjectStringIdentifies the user or client ID that the token represents.
`aud`AudienceString/ArrayIdentifies the intended recipient services for this token.
`exp`Expiration TimeUnix TimestampMandatory expiration epoch time after which token MUST NOT be accepted.
`nbf`Not BeforeUnix TimestampToken must not be accepted prior to this timestamp.
`iat`Issued AtUnix TimestampTimestamp recording exact second token was generated.

Critical JWT Security Checklist

Rules to prevent critical authentication bypass vulnerabilities.

VulnerabilityAttack VectorMandatory Mitigation
The "None" Algorithm AttackAttacker sets `"alg": "none"` in header to bypass signature verification entirely.Strictly reject any token where `alg` is none, whitespace, or missing.
HMAC vs RSA Key ConfusionAttacker signs token with server's public key using symmetric HS256 instead of RS256.Hard-code expected verification algorithm on server; do not read algorithm from token header.
Sensitive Data in PayloadStoring passwords, PII, or internal secrets in payload.JWTs are only signed, NOT encrypted! Anyone can decode Base64 strings.

Frequently Asked Questions

Are JWT tokens encrypted?

No! Standard JWTs (JWS) are digitally SIGNED, not encrypted. The header and payload are simply Base64URL-encoded JSON. Anyone who intercepts the token can read the claims.

How can I decode and inspect a JWT without exposing it to third-party servers?

Use DocSwift's in-browser JWT Debugger. It parses header, claims, and expiration timestamps locally in your browser memory with zero network uploads.