liveBook · Manning

JSON Web Token

As explained in Software Security for Developers

JSON Web Token is a compact, URL-safe format for representing claims that can be transmitted between parties.

A JSON Web Token (JWT) is a compact, URL-safe token format for transmitting claims between parties. It is commonly used as an access token in OAuth 2 and OpenID Connect (OIDC), where a backend can validate the token and use its claims for authorization. section 11.6 section 12.2.2

A signed JWT has three parts:

  • The header contains metadata such as the signing algorithm, key ID, and token type. section 12.2.2
  • The payload is a JSON object containing claims such as the subject, username, roles, client identifier, or expiration time. section 11.6 section 12.2.2
  • The signature helps verify that the token was not tampered with and remains valid. section 12.2.2

A practical security boundary

An API might receive a JWT containing a subject, name, and issue time. The backend verifies its signature before using the claims. Short-lived access tokens—usually an hour or less—limit the damage if a token is stolen. Configuration still matters: accepting the JWS algorithm value none can disable signature validation, allowing an attacker to modify the payload. Libraries should therefore reject none explicitly. section 12.2.2 section 11.6

Figure 11.7 The collection of standards. JWT builds on top of the JWE and JWS standards. JWT is the token format for the OIDC standard.
figure

Use the standards relationship to distinguish JWT from JWS and JWE: JWT requires a JSON payload, while JWS and JWE can carry other data types; JWT commonly formats OIDC tokens. section 11.6

How Software Security for Developers covers it

How deep it goes
Explains structure, claims, validation, expiration, standards relationships, and alg:none risk without developing public-key cryptography.
Examples
Shows a three-part token, decoded header and payload JSON, subject claims, short expiration, and an alg:none tampering scenario.
What you can do after
Diagnose JWT structure, verify signatures, interpret claims, and configure libraries to reject insecure algorithm choices.
How it connects
Connects JWT with JWS, JWE, JWK, OAuth 2, OpenID Connect, access tokens, ID tokens, and token introspection.

Also explained in

Compare how 11 books explain JSON Web Token →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.