JWT vs PASETO
One format gives you infinite flexibility and a loaded footgun; the other takes the gun away.
JWT is a flexible standard that lets the token itself declare which algorithm to use — which opens real attacks like alg:none and RSA-to-HMAC algorithm confusion. PASETO removes the choice: each versioned token binds to one vetted cipher suite and one of two purposes (local or public), so the dangerous knobs simply don't exist. JWT wins on ubiquity; PASETO wins on safe defaults.
JWT is a blank cheque
A JWT is a signed JSON blob whose own header declares the algorithm. That flexibility is its selling point — any signing scheme, any claims — but it means the token gets a vote in how it is verified, which is a strange thing to trust an attacker-supplied string to do.
Footgun: alg:none
The spec includes a 'none' algorithm for unsigned tokens. A verifier that trusts the header will see alg:none, skip signature checking, and accept a token an attacker wrote by hand. Libraries have shipped this exact bug; the defense is to hard-code the accepted algorithm server-side.
Footgun: algorithm confusion
A server expecting RS256 (verify with a public key) can be tricked by a token that says HS256. If the code naively uses its RSA public key as the HMAC secret, the attacker — who also has the public key — can forge a valid signature. One key, two algorithms, total bypass.
PASETO pins a version
PASETO tokens start with a version tag like v4. Each version hard-codes one vetted, modern cipher suite, so there is no algorithm field for the token to negotiate. You cannot request 'none' or downgrade the cipher because the choice was made by the protocol designers, not the message.
Two purposes, not twenty
Every PASETO is either 'local' (symmetric, so the payload is encrypted and authenticated) or 'public' (asymmetric, signed and verifiable with a public key). Those are the only two modes, matching the two real use cases and removing the misconfiguration surface JWT exposes.
When each fits
JWT still wins on ubiquity: every OAuth/OIDC stack, gateway, and library speaks it, and it is the safe default when interoperability rules. Reach for PASETO on greenfield systems where you control both ends and want strong defaults with far fewer ways to hold it wrong.
Same job, different philosophy
JWT and PASETO solve the same problem — carrying signed, self-describing claims so a server can trust a request statelessly — but they embody opposite philosophies about how much freedom to give the developer. JWT is a flexible, kitchen-sink standard: it supports a whole menu of signing and encryption algorithms and lets each token declare which one it uses. PASETO (Platform-Agnostic Security Tokens) was designed later, explicitly as a reaction to the ways JWT's flexibility goes wrong, and it takes the dangerous choices off the table.
The tension between them is a classic security theme: flexibility versus safe defaults. Flexibility is genuinely useful — it is why JWT became the backbone of OAuth 2.0 and OpenID Connect and is understood by virtually every gateway and library on earth. But every knob a format exposes is also a knob a developer can set wrong or an attacker can try to turn. PASETO's bet is that for authentication tokens, fewer knobs is strictly better.
JWT's flexibility, and its footguns
A JWT's header carries an alg field, and this is the root of its most famous weaknesses. The verifier is, in the naive case, told by the token itself how to check the token — and trusting attacker-controlled input to choose your security mechanism is a shaky foundation.
Two attacks make this concrete:
- alg:none — the JWT spec defines a "none" algorithm for unsigned tokens. A library that honors the header will see
{"alg":"none"}, skip signature verification entirely, and accept whatever payload the attacker typed. Real libraries shipped this bug, letting anyone mint an admin token by hand. - Algorithm confusion — a server that expects
RS256verifies with an RSA public key, which by design is not secret. If an attacker changes the header toHS256(HMAC) and the server's code naively uses that same public key as the HMAC secret, the attacker — who also knows the public key — can compute a valid signature and forge any token.
Both bugs share a root cause: the token influences how it is verified. The correct defense is to ignore the token's `alg` and pin the accepted algorithm on the server, but the fact that this defense is even necessary is the point. The format makes the insecure path easy.
PASETO's opinionated design
PASETO removes the sharp edges by making the security-critical decisions itself. Its two organizing ideas are versions and purposes.
Every PASETO token begins with a version tag such as v2 or v4. A version is not a flag you tune — it is a fixed bundle of modern, vetted cryptography. v4, for example, pins signing to Ed25519 and symmetric encryption to a specific authenticated cipher. Because the version dictates the algorithm, there is no alg field for a token to lie about, which eliminates both alg:none and algorithm confusion by construction rather than by careful coding. When cryptography advances, the designers publish a new version; you don't negotiate it per token.
Each token also declares one of exactly two purposes:
- local — symmetric keys. The payload is *encrypted* and authenticated, so the claims are confidential as well as tamper-proof. Use it when a single trusted party both issues and reads the token.
- public — asymmetric keys. The payload is signed (not encrypted) and anyone with the public key can verify it, mirroring JWT's
RS256/ES256use case.
Two purposes cover the two situations that actually exist, and naming them explicitly stops the common JWT mistake of confusing "signed" with "confidential."
Safe by default versus flexible by default
The heart of the comparison is what happens when a developer does the easy, obvious thing.
With JWT, the easy path can be the insecure one: pick a library, pass in the token, and unless you explicitly restrict the algorithm you may have quietly opted into alg:none or a confusion attack. Security depends on the developer knowing the footguns and disarming them.
With PASETO, the easy path is the secure one. You choose a version and a purpose up front — decisions that are hard to get subtly wrong — and from then on the cryptography is fixed and strong. There is no downgrade to negotiate, no "none" to accept, no public-key-as-HMAC-secret confusion, because those degrees of freedom were designed out. PASETO also uses implicit assertions and strict encoding to close side channels JWT leaves open. The trade is exactly the one you'd expect: you give up flexibility (you can't mix and match algorithms) in return for a much smaller surface of misconfiguration.
When to reach for each
Neither format is universally "better"; they fit different situations.
Reach for JWT when interoperability dominates. If you're integrating with OAuth 2.0, OpenID Connect, an identity provider, an API gateway, or any third party, JWT is the lingua franca — the tooling is mature, the libraries are everywhere, and everyone already speaks it. The footguns are well-documented and entirely avoidable with a couple of disciplined rules: pin the algorithm server-side, validate every claim, and never trust the header's alg.
Reach for PASETO when you control both ends and want strong defaults with the least room for error — a greenfield service, an internal system, a new mobile backend where you issue and consume the tokens yourself. You give up some ecosystem breadth (fewer libraries, less third-party recognition) but gain a format where the insecure options simply don't exist.
The broader lesson outlives the specific standards: when a security primitive exposes dangerous flexibility, the mature move is often to constrain it. PASETO is what you get when someone studies a widely-deployed format's real-world failures and asks, "what if the token just couldn't do the dangerous thing?"
JWT's flexibility is its risk: the token's own header names the algorithm the verifier will use.
alg:none — a naive verifier honors a token that declares 'no signature' and skips the check entirely.
Algorithm confusion — an attacker changes RS256 to HS256 and signs with the public key as the HMAC secret.
PASETO is versioned: v1–v4 each pin exactly one modern cipher suite, so there is nothing to negotiate.
PASETO offers two purposes: local (symmetric, encrypted) and public (asymmetric, signed) — no ambiguity.
Choose JWT for maximum ecosystem support; choose PASETO when you want secure-by-default with fewer sharp edges.
Quick quiz
What is the 'algorithm confusion' attack against JWT?
How does PASETO structurally avoid the alg:none and confusion attacks?
JWT explained
A signed, self-describing token that lets a server trust a request without looking anything up.
Sessions, cookies, JWT & OAuth 2.0
How a server remembers who you are — and who let you in.
Top tips for API security
An API is a door into your data — these are the locks every one of them needs.
Tokens vs API keys
One names an application, the other names a session — and that difference decides everything.