Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is a JSON Web Token?

A JSON Web Token is a compact, signed set of claims that a service can verify without calling back to the issuer. Its convenience is also the source of most JWT bugs.

Illustration for the cybersecurity term JSON Web Token
Home / Blog / Cybersecurity Terms / What Is a JSON Web Token?
17 November 2026

What Is a JSON Web Token?

What Is a JSON Web Token?

A JSON Web Token is three base64url-encoded segments separated by full stops: a header saying how it was signed, a payload of claims, and a signature over the first two. RFC 7519 defines it, and it is now the default currency of API authentication, OpenID Connect identity assertions, and session state in distributed systems.

The appeal is that verification is local. A service that holds the right key can check the signature and read the claims without a network call to the issuer, which is exactly what you want when forty microservices need to make authorisation decisions a thousand times a second.

Reading One

{
  "alg": "RS256",
  "typ": "JWT",
  "kid": "2024-prod-a"
}
.
{
  "iss": "https://login.example.co.uk",
  "sub": "4f9c21e0-88b1-4c3a-9c0e-3a1d2b7f6e54",
  "aud": "https://api.example.co.uk/payments",
  "exp": 1763208000,
  "iat": 1763204400,
  "scope": "payments.read payments.write"
}

Note what the payload is not: encrypted. Base64url is an encoding, not a cipher, and anyone holding the token can read every claim in it. Putting a national insurance number, a home address, or an internal database identifier in a JWT discloses it to the client and to anything that logs the request. Where claims genuinely must be confidential, the answer is JSON Web Encryption rather than hope.

Validation Is a Checklist, Not a Signature Check

The most common vulnerability class is not a broken algorithm but an incomplete check. A correct validator confirms, in order:

The Classic Failures

The none algorithm. RFC 7519 permits alg: none for unsecured tokens. Libraries that honoured it would accept a token with no signature at all, letting an attacker rewrite claims freely. Most libraries now refuse it by default, but the pattern recurs in hand-rolled validators.

Algorithm confusion. A service configured for RS256 verifies with a public key. An attacker changes the header to HS256 and signs the token using that public key as the HMAC secret. A naive library that selects the verification algorithm from the token header will accept it, because the public key is public. Our entry on JWT algorithm confusion covers this in detail.

Weak HMAC secrets. HS256 tokens signed with a short or guessable secret can be cracked offline with hashcat in minutes. If you use symmetric signing, the secret needs the entropy of a cryptographic key, held in a secrets manager, not a value from a configuration file.

Header injection. The jku and x5u header parameters point at a key set URL, and jwk embeds a key directly. A validator that trusts any of them is letting the attacker supply the verification key. Allow-list the key source.

The Revocation Problem

Stateless verification means a valid, unexpired token keeps working after you disable the account, because no service asks the issuer anything. An attacker with a stolen token therefore has access until expiry regardless of what you do to the user record.

Nobody has solved this elegantly. The workable combination is short access token lifetimes—five to fifteen minutes—with longer refresh tokens that are checked against server-side state, a denylist of revoked token identifiers for the brief window that matters, and continuous access evaluation where your platform supports it. Token introspection reintroduces the issuer call for high-value operations, trading some performance for immediate revocation.

Sender-constrained tokens address the other half of the problem. Binding a token to a client-held key with DPoP, or to a certificate with mutual TLS, makes a stolen token useless rather than merely short-lived.

One storage note that is routinely got wrong in browsers: a token in localStorage is readable by any script on the page, so a single cross-site scripting flaw becomes full account takeover. Prefer a cookie marked HttpOnly, Secure, and SameSite.

At Privia Security, we test token issuance and validation logic as part of our web application security services.

FAQ – Frequently Asked Questions

Is the Data in a JWT Encrypted?

No. The header and payload are base64url-encoded, which is reversible by anyone holding the token, including the client and anything that logs it. A signed JWT guarantees integrity and origin, not confidentiality. If claims must stay secret, use JSON Web Encryption, or keep the sensitive value server-side and put an opaque reference in the token instead.

How Do I Revoke a JSON Web Token?

You cannot revoke the token itself, because services verify it locally without contacting the issuer. The practical approach is short access token lifetimes of a few minutes, refresh tokens validated against server-side state, a short-lived denylist of revoked token identifiers, and introspection for high-value operations. Continuous access evaluation shortens the window further where the platform supports it.

Should I Store a JWT in localStorage?

Avoid it in browsers. Anything in localStorage is readable by any JavaScript running on the page, so one cross-site scripting flaw turns into complete account takeover. A cookie with the HttpOnly, Secure, and SameSite attributes keeps the token out of reach of page scripts, at the cost of needing cross-site request forgery protection on state-changing requests.

What Is the Audience Claim For?

The aud claim names the service the token was issued for, and each service must reject tokens that name a different audience. Without that check, a token obtained legitimately for a low-value API can be replayed against a high-value one that shares the same issuer. It is one of the cheapest validation steps and one of the most frequently omitted.

Related Terms

You May Be Interested In These

What Is ISO 22301?

Cybersecurity Terms

17 November 2026

What Is ISO 22301?

Read More
What Are CSIRT and CERT?

Cybersecurity Terms

17 November 2026

What Are CSIRT and CERT?

Read More
What Is a Content Delivery Network?

Cybersecurity Terms

17 November 2026

What Is a Content Delivery Network?

Read More