JSON Web Token Best Current Practices
RFC 8725 · RFC8725 · BCP 225
By Boston Identity · Explained · 7 min read
The short answer
RFC 8725 is the IETF's rulebook for checking JSON Web Tokens safely. It tells token libraries and applications what to check before trusting a token: the algorithm, every signature, the issuer's keys, the audience and the token's kind.
- What it is
- A practice
- Defined by
- IETF, RFC 8725 (BCP 225), 2020
- Who it's for
- Teams that issue or accept JWTs
- In our briefings
- 280by month, last 12
What is JSON Web Token Best Current Practices?
A JSON Web Token (JWT) is a compact security token that carries a set of claims and can be signed, encrypted or both.§1 One common use is digital identity: OpenID Connect ID tokens and OAuth (Open Authorization) 2.0 access and refresh tokens are often JWTs.§1 RFC 8725 is a Best Current Practice (BCP 225) from the Internet Engineering Task Force (IETF), published in February 2020, and it updates RFC 7519, the JWT standard.S1
The authors wrote it because attacks on JWT implementations and deployments kept being published after RFC 7519 came out. They trace those attacks to under-specified security mechanisms, incomplete implementations and applications using JWTs incorrectly.§1 Section 2 lists nine threats, and section 3 gives twelve practices that answer them.§2,§3
The RFC is written for three groups: people who build JWT libraries, people who write code that uses those libraries, and people who write specifications that rely on JWTs.§1.1 It calls its rules a floor, not a ceiling. It also calls itself a point-in-time statement and tells readers to look for errata and updates.§1
RFC 8725 is guidance, not a new token format or protocol. It tells implementers how to use the mechanisms and claims that RFC 7519, JSON Web Signature (JWS) and JSON Web Encryption (JWE) already define.§1
How does JSON Web Token Best Current Practices work?
We list the checks in the order a recipient meets them; the RFC numbers them as separate practices.§3 The actors are the issuer that signs the token, the JWT library that does the cryptography, and the application that calls the library and decides whether to trust the result.
Figure steps
- The application fixes the allowed algorithms
- The application finds the key without trusting the header
- The library validates every cryptographic operation
- The application ties the keys to the issuer
- The application checks the audience
- The application checks the token is the right kind
The checks RFC 8725 asks a JWT recipient to run, in the order the token meets them.
Drawn from RFC 8725, section 3
Swipe for the full figure →
The application fixes the allowed algorithms
Before any token arrives, the application tells the library which algorithms it supports. Libraries must make that possible and must not use any other algorithm.§3.1 The "alg" or "enc" header must name the algorithm actually used. Each key must be used with exactly one algorithm, and the library must check this when it runs the operation.§3.1 Libraries should not accept tokens marked "none" unless the caller explicitly asks.§3.2
The application finds the key without trusting the header
The "kid" (key ID) header tells the application which key to look up. Applications should validate or sanitise that value so the lookup cannot become SQL or LDAP (Lightweight Directory Access Protocol) injection.§3.10 A "jku" or "x5u" header holds a URL, and blindly following it can lead to server-side request forgery (SSRF). Applications should guard against that, for example by matching the URL to a list of allowed locations and sending no cookies with the request.§3.10
The library validates every cryptographic operation
Every signature and decryption in the token must be validated, and the whole token must be rejected if any one fails.§3.3 In a Nested JWT, such as a signed token inside an encrypted one, both the outer and inner layers must be checked with keys and algorithms the application supplies.§3.3 Inputs to elliptic curve key agreement, such as curve points, must be validated too, by the token library or the cryptographic library beneath it.§3.4
The application ties the keys to the issuer
When the token has an "iss" (issuer) claim, the application must confirm that the signing keys belong to that issuer. If they do not, it must reject the token.§3.8 How to find an issuer's keys is up to the application. In OpenID Connect, the issuer URL leads to a metadata document whose "jwks_uri" value points to the issuer's published keys.§3.8 When there is a "sub" (subject) claim, the application must check that it names a valid subject, or a valid issuer-subject pair, and reject the token if not.§3.8
The application checks the audience
Some issuers issue JWTs for more than one relying party, the application that accepts the token. Then the token must carry an "aud" (audience) claim.§3.9 Each relying party must reject a token whose audience is missing or is not its own.§3.9 This check answers substitution: a service that legitimately received a token presents it to a different service it was not meant for.§2.7
The application checks the token is the right kind
When one issuer issues more than one kind of JWT, the validation rules for each kind must be mutually exclusive, so a token of the wrong kind fails.§3.12 The RFC lists ways to get there: distinct "typ" values, different required claims or headers, different keys, different audiences or different issuers.§3.12 Explicit typing with the "typ" header is recommended for new uses of JWTs.§3.11
Why does JSON Web Token Best Current Practices matter now?
RFC 8725 hardened advice that RFC 7519 had left soft. RFC 7519 made “none” mandatory to implement and left refusing an unwanted algorithm to the application, as a SHOULD.1 Under RFC 8725, the caller names the supported algorithms, the library must use no other, and each key must be used with exactly one algorithm.2 Those rules answer attacks the RFC cites. In one, a header switched to “none” was accepted by some libraries without any signature check. In another, an RS256 token relabelled HS256 was verified by some libraries with the RSA public key as the shared secret.2
Some of its rules stay soft. The RFC still allows “none” when other means such as TLS (Transport Layer Security) protect the token; libraries only SHOULD NOT accept it unless the caller asks.2 Explicit typing is a recommendation, and the authors concede it may not tell a new kind of JWT from existing kinds.3
An IETF draft that would replace RFC 8725 adds fixes for attacks found since.4 Two of them are MUSTs. Libraries must let the verifier tell a signed JWT from an encrypted one, and the draft cites CVE-2023-51774 for libraries that cannot tell a successful decryption from a successful signature check.4 A token with characters other than letters, numbers, dash, underscore and period must be rejected.4 Against an algorithm name like “noNE” slipping past a blocklist, the draft only says libraries SHOULD use allowlists.4
Where does it fit?
| Compared with | How JSON Web Token Best Current Practices differs |
|---|---|
| JSON Web Signature | JWS (RFC 7515) defines how a token is signed and how the signature is checked. RFC 8725 sits on top of it and quotes its rule that a JWS validated with an algorithm the application does not accept should be treated as invalid.§3.2 |
| JSON Web Encryption | JWE (RFC 7516) is the format for encrypting a token. RFC 8725 warns that some libraries decrypt a JWE and then skip the signature inside it, so it requires both layers of a Nested JWT to be validated.§2.3,§3.3 |
| JSON Web Key (JWK) | A JWK Set (RFC 7517) is one way an issuer's keys are published: in the RFC's example, OpenID Connect fetches an issuer's keys in that form.§3.8 RFC 8725 leaves the format alone and requires the application to confirm that the keys used on a token belong to its issuer.§3.8 |
| OAuth 2.0 Authorization Server Metadata | RFC 8414 is a metadata standard, and RFC 8725 names it as using the same issuer-to-keys mechanism as OpenID Connect: an https issuer URL, a metadata document and a "jwks_uri".§3.8 RFC 8725 leaves the lookup to the application; its rule is that the keys must belong to the issuer.§3.8 |
What goes wrong?
- Weak shared secrets: some applications sign with a keyed message authentication code (MAC) such as HS256 and use a human-memorable password as the key. Anyone who gets hold of one token can then try to guess the key offline.§2.2 The RFC says such passwords must not be used directly as the key.§3.5
- Compression before encryption: many encryption algorithms leak the length of the plaintext, and compressing first makes that length depend on the content. The RFC says data should not be compressed before encryption.§2.4,§3.6
- Unchecked curve points: several libraries failed to validate inputs to elliptic curve key agreement. An attacker who can send crafted tokens and see the decrypted output can recover the recipient's private key.§2.5
- Mixed text encodings: older JSON allowed UTF-16 and UTF-32 as well as UTF-8, and a malicious sender could use that ambiguity to slip past a recipient's checks. Implementations must use UTF-8 only.§2.6,§3.7
What should a security leader ask?
- 01
Have we pinned the accepted algorithms in every service that accepts JWTs, or does any service still trust the token's own "alg" header?
- 02
Which of our services accept tokens from an issuer that also issues tokens for other applications, and does each one reject a token whose audience is missing or not its own?
- 03
Where does any service fetch keys from a "jku" or "x5u" URL in a token header, and is that URL checked against an allowed list?
- 04
Does any service accept tokens marked "none", and who approved that?
Sources
- S1
RFC 8725: JSON Web Token Best Current PracticesIETF · Best Current Practice (BCP 225), February 2020
›Evidence: 4 claims from 3 briefings
- 1BI-FIND-2015-0012 · RFC 7519 makes "none" mandatory to implement and leaves refusing an unwanted algorithm as a SHOULDRFC 7519 makes "none" mandatory to implement and leaves refusing an unwanted algorithm to the application, as a SHOULD. Section 8 names HS256 and "none" as the only signature and MAC algorithms that conforming JWT implementations MUST implement; RS256 and ES256 are RECOMMENDED. Section 6 says an Unsecured JWT, with "alg" set to "none" and an empty signature, MAY be created when something outside the token secures it. Section 7.2 hands the signature check to the JWS specification, then calls the choice of algorithms "an application decision": a JWT that validates with an algorithm the application does not accept SHOULD be rejected. Our briefing on RFC 8725, the later update, covers the rules that now make libraries let the caller fix the allowed algorithms and refuse the rest.
- 2BI-FIND-2020-0011 · RFC 8725: the caller, not the JWT header, picks the algorithm, and "none" is discouraged, not bannedUnder RFC 8725, the caller decides which algorithms a JWT library will use. Libraries MUST let the caller name a supported set and MUST NOT use any other, the "alg" or "enc" header MUST match the algorithm actually used, and each key MUST be used with exactly one algorithm, checked when the operation runs. These rules answer attacks the RFC cites: a header switched to "none" that some libraries accepted without checking any signature, and an RS256 token relabelled HS256 that some libraries verified with the RSA public key as the HMAC secret. The RFC still allows "none": it says the algorithm "can be perfectly acceptable" when the token is protected by other means such as TLS, and that libraries SHOULD NOT generate or accept it unless the caller explicitly asks.
- 3BI-FIND-2020-0013 · RFC 8725: the caller, not the JWT header, picks the algorithm, and "none" is discouraged, not bannedRFC 8725's firm rule against one kind of JWT being accepted as another is about validation logic. When one issuer can issue more than one kind of JWT, the validation rules for those kinds MUST be written to be mutually exclusive, rejecting tokens of the wrong kind. Explicit typing with the "typ" header is RECOMMENDED for new uses of JWTs, and the authors concede it "may not achieve disambiguation from existing kinds of JWTs", because the validation rules for existing kinds often ignore "typ".
- 4BI-FIND-2026-1063 · The draft replacing RFC 8725 requires rejecting malformed JWTs but only recommends denial-of-service limitsTwo of the fixes the draft adds for attacks found since RFC 8725 are MUSTs. Libraries must let the verifier tell a signed JWT from an encrypted one; the draft cites CVE-2023-51774 for libraries that do not distinguish a successful decryption from a successful signature validation. And any token with characters other than letters, numbers, dash, underscore and period "is not a JWT and MUST be rejected", the draft's answer to tokens verified in JSON form but read as compact ones. A third fix is softer: against an algorithm name like "noNE" slipping past a blocklist, libraries SHOULD use allowlists.
›In our briefings
What our briefings say about JSON Web Token Best Current Practices itself, with the most direct claims first.
Two of the fixes the draft adds for attacks found since RFC 8725 are MUSTs. Libraries must let the verifier tell a signed JWT from an encrypted one; the draft cites CVE-2023-51774 for libraries that do not distinguish a successful decryption from a successful signature validation. And any token with characters other than letters, numbers, dash, underscore and period "is not a JWT and MUST be rejected", the draft's answer to tokens verified in JSON form but read as compact ones. A third fix is softer: against an algorithm name like "noNE" slipping past a blocklist, libraries SHOULD use allowlists.
The draft replacing RFC 8725 requires rejecting malformed JWTs but only recommends denial-of-service limitsBI-FIND-2026-1063
Under RFC 8725, the caller decides which algorithms a JWT library will use. Libraries MUST let the caller name a supported set and MUST NOT use any other, the "alg" or "enc" header MUST match the algorithm actually used, and each key MUST be used with exactly one algorithm, checked when the operation runs. These rules answer attacks the RFC cites: a header switched to "none" that some libraries accepted without checking any signature, and an RS256 token relabelled HS256 that some libraries verified with the RSA public key as the HMAC secret. The RFC still allows "none": it says the algorithm "can be perfectly acceptable" when the token is protected by other means such as TLS, and that libraries SHOULD NOT generate or accept it unless the caller explicitly asks.
RFC 8725: the caller, not the JWT header, picks the algorithm, and "none" is discouraged, not bannedBI-FIND-2020-0011
›Cited in 28 briefings
Every briefing that discusses this term, newest first.
- OAuth's token revocation list nears RFC, and a shared list hides which token is checked
Draft · · IETF Datatracker · Tobias Looker et al. · Aug 13, 2026
- An agent-mandate draft checks who may delegate, and now intends to carry its chain in Asor's format
Draft · · IETF Datatracker · Claudiu Hulea, Braincap SRL · Oct 24, 2026
- An OAuth client gets to name who vouches for it, and removing one waits on server caches
Draft · · IETF Datatracker · Karl McGuinness · Sep 28, 2026
- Register a platform's identity provider once, not each agent: trust rests on its issuer, with no revocation
Draft · · IETF Datatracker · Paul Carleton et al. · Sep 22, 2026
- OAuth's URL client ID draft tightens server rules in -03; the client is still whoever controls the URL
Draft · · IETF Datatracker · Aaron Parecki et al. · Jul 6, 2026
- Cross-App Access draft warns that one stolen sign-in token could reach every app the identity provider permits
Draft · · IETF Datatracker · Aaron Parecki et al. · May 21, 2026
- RFC 9207's issuer check stops at the redirect, and n8n's token-exchange flaw sat just past it
Article · · WorkOS · Maria Paktiti · Jul 20, 2026
- Agent URI draft -04 ties an agent's name to a key document and bars OAuth servers from trusting the name alone
Draft · · IETF Datatracker · Yaswanth Narvaneni et al. · Oct 20, 2026
- Agent delegation records not anchored in trusted time become deniable once timestamps can be forged
Draft · · IETF Datatracker · V.K. Uppalapati · Sep 29, 2026
- Niyikiza's agent tokens narrow to a tool's arguments offline; revision -02 breaks -01 implementations
Draft · · IETF Datatracker · Niki Aimable Niyikiza · Jun 15, 2026
- Drake's agent-mail draft puts hardware-maker proof on hold, but its abstract still offers it
Draft · · IETF Datatracker · Christopher Drake, 1id.com · Oct 27, 2026
- A cross-domain transaction-token grant now names AI agents as a use and keeps the call chain at home
Draft · · IETF Datatracker · George Fletcher et al. · Sep 10, 2026
- RFC 9943 makes a log prove who signed a statement, not that it is true or that nothing was left out
Article · · IETF (RFC Editor) · Henk Birkholz et al. · Jun 30, 2026
- The SD-JWT standard that agent drafts build on never mentions agents and leaves key binding to each verifier
Article · · IETF (RFC Editor) · Daniel Fett et al. · Nov 20, 2025
- OpenID Federation 1.0 lets each level of a trust chain only tighten the rules, and defines no revocation process
Article · · OpenID Foundation · Roland Hedberg et al. · Feb 17, 2026
- In Huawei's reworked OAuth draft, evidence signed by the token's subject can narrow access but never widen it
Draft · · IETF Datatracker · Cheng-Kang Chu et al. · Sep 1, 2026
- NIST and CISA advise one-hour tokens, 90-day keys and hardware key storage; AI agents get one paragraph
Article · · NIST (CSRC) · Ryan Galluzzo et al. · Sep 15, 2026
- Atlassian's first draft for offline delegation banned bearer handles; revision 05 just recommends sender binding
Draft · · IETF Datatracker · Larry Zhu et al. · May 22, 2026
- The draft replacing RFC 8725 requires rejecting malformed JWTs but only recommends denial-of-service limits
Draft · · IETF datatracker · Yaron Sheffer et al. · Jan 12, 2026
- Huawei-led OAuth draft lets clients chain narrower tokens offline but leaves revocation delivery out of scope
Draft · · IETF Datatracker · Li Ruochen et al. · Oct 20, 2025
- WIMSE leaves its application proof choice open, with different integrity coverage
Draft · · IETF Datatracker · Brian Campbell et al. · Oct 16, 2025
- The July 2025 Cross App Access draft lets the IdP decide app-to-app access and treats agents as plain clients
Draft · · IETF Datatracker · Aaron Parecki et al. · Jul 2, 2025
- FAPI 2.0 issues only sender-constrained access tokens and leaves public clients out
Article · · OpenID Foundation · Daniel Fett et al. · Feb 22, 2025
- DPoP token binding depends on checks at the resource server
Article · · RFC Editor · Daniel Fett et al. · Sep 2023
- RFC 9068 makes resource servers check a JWT access token's type and audience, and warns a client could pose as a user
Article · · RFC Editor · Vittorio Bertocci, Okta · Oct 1, 2021
- Signed OAuth requests can be bypassed until the server refuses unsigned ones, and RFC 9101 leaves that off by default
Article · · RFC Editor · Nat Sakimura et al. · Aug 1, 2021
- RFC 8725: the caller, not the JWT header, picks the algorithm, and "none" is discouraged, not banned
Article · · RFC Editor · Yaron Sheffer et al. · Feb 2020
- RFC 7519 makes "none" mandatory to implement and leaves refusing an unwanted algorithm as a SHOULD
Article · · RFC Editor · Michael B. Jones et al. · May 1, 2015
Related terms
What appears alongside JSON Web Token Best Current Practices in the same briefings.
Proof-of-Possession Key Semantics for JWTs (RFC 7800)OAuth 2.0 Authorization Server MetadataJSON Web SignatureJSON Web Key (JWK)Resource Indicators for OAuth 2.0JOSEOAuth Identity and Authorization Chaining Across DomainsES256
Was this explainer useful?
Share this explainer
Every finding, forecast and open question on this site has a permanent ID. If we reword one, its ID stays the same, so a citation keeps pointing to the same claim.
Working on an identity problem that involves JSON Web Token Best Current Practices? Talk to Boston Identity