Token Decoder Tools — JWT, PASETO, SAML & OIDC
Work with modern authentication and security token formats. Decode, verify, generate, and inspect — all client-side, zero server exposure for your data.
What Are Security Tokens? JWT, PASETO, and Token Authentication Explained
When you sign in with Google or Facebook on a new app, that app never sees your password — instead, it gets a tiny, signed piece of data that proves who you are. That's a security token — a digital credential used to authenticate users, authorize access, or securely transmit identity information between systems. In modern authentication architectures, tokens replace traditional session-based cookies by providing a stateless, portable way to verify that a request comes from an authenticated party. A token typically contains information about the user (claims), issuance and expiration timestamps, and a cryptographic signature or proof that prevents tampering. Token-based authentication is the foundation of modern APIs, single sign-on (SSO), and distributed system security. Popular token formats include JWT, PASETO, opaque tokens, SAML assertions, and OIDC ID tokens.
Different token types serve different purposes. JWT (JSON Web Tokens) are the most widely adopted — self-contained tokens with JSON claims signed via HMAC or public-key cryptography. PASETO offers a more secure alternative by eliminating algorithm agility vulnerabilities through versioned, fixed-algorithm protocols (v4.public for Ed25519, v4.local for XChaCha20-Poly1305). Opaque tokens are random strings validated via server-side lookup, offering instant revocation at the cost of requiring database queries. SAML assertions are XML-based tokens used primarily in enterprise SSO (often paired with OIDC). OIDC ID Tokens (OpenID Connect) are JWTs specifically designed to convey identity information from identity providers to relying parties.
Choosing the right token format depends on your requirements. JWT is the default choice for most web and mobile APIs due to broad ecosystem support. PASETO is recommended when security is paramount and algorithm agility must be eliminated. Opaque tokens suit scenarios requiring immediate revocation or regulatory limits on embedded claims. SAML remains necessary for enterprise federation with legacy identity providers. For the underlying cryptographic primitives used in token signing and verification, explore our HMAC generator and Base64 decoder. All BetterPass token tools operate entirely client-side — your tokens are decoded, verified, and inspected in your browser without ever being sent to a server.
Curious how these formats actually differ in practice? The JWT vs PASETO Playground lets you feed in one JSON payload and one key, then see both token types generated side by side with live byte-size counts and verification timing.
JWT Encode/Decode
Encode, Decode, and verify JWTs across HS256/384/512, RS256/384/512, PS256/384/512, and ES256/384/512 with JWKS kid matching — inspect claims (iss, sub, aud, exp) with live expiry countdowns.
PASETO Encoder & Decoder
Create, decode, and verify PASETO v2/v4 tokens — sign v4.public (Ed25519), encrypt v4.local (XChaCha20-Poly1305), and generate Ed25519 keypairs and symmetric keys. Browser-side, your tokens never leave your device.
Opaque Token Generator
Generate cryptographically random opaque tokens for session IDs, API keys, and one-time secrets. Configurable-length random tokens (8-256 characters) — store the hash, not the token.
SAML Assertion Decoder
Decode SAML assertions with automatic Base64 and DEFLATE decompression. Inspect XML for Issuer, Subject, Conditions, and signatures — essential for SSO troubleshooting.
OIDC ID Token
Decode and verify OpenID Connect ID Tokens using RS256 signatures from JWKS endpoints. Validate iss, aud, exp, nonce, and standard profile claims in your browser.
JWT vs PASETO Playground
Compare JWT HS256 and PASETO v4.local side by side from the same payload and key — see token structure, byte-size overhead, signing vs encryption, and live round-trip verification.
Choosing the Right Token Type
Token formats serve different purposes. The right type depends on your architecture and security requirements:
1. Stateless API Authentication
JWT (RS256/ES256) — Best for microservices, mobile apps, and SPAs needing offline verification. Self-contained tokens with embedded claims (iss, sub, aud, exp). Stateless — no database lookup required. Use asymmetric algorithms (RS256, ES256) for cross-service trust.
PASETO v4.public — Modern alternative to JWT with Ed25519 signatures. Fixed algorithm per version eliminates JWT's algorithm confusion attacks. Key separation prevents encryption/signing key misuse.
2. Revocable Session Tokens
Opaque Tokens — Best for traditional web apps, admin panels, and compliance-heavy environments. Random string validated via server-side lookup (Redis/DB). Instant revocation — just delete from store. No claims embedded, minimal client-side info.
3. Enterprise SSO & Federation
SAML Assertion — XML-based SSO standard used with ADFS, Okta, Azure AD, and PingIdentity. Supports complex federation scenarios with IdP/SP metadata exchange. Decode Base64/DEFLATE encoded assertions for troubleshooting.
4. OpenID Connect & User Identity
OIDC ID Token — JWT-based identity layer on top of OAuth 2.0. Contains verified user identity claims (sub, email, name). Verify with provider's JWKS endpoint. Used by Google, Microsoft, GitHub, Auth0, Keycloak, and custom providers.
Quick Token Type Selection
Stateless API Auth
Microservices, mobile apps, SPAs needing offline verification
Revocable Session Tokens
Traditional web apps, admin panels, compliance-heavy environments
Enterprise SSO / Federation
SAML 2.0, ADFS, Okta, Azure AD, PingIdentity
OpenID Connect Login
Google, Microsoft, GitHub, Auth0, Keycloak, custom OIDC providers
Modern Crypto-First Design
New projects wanting to avoid JWT algorithm confusion
Simple API Keys / Secrets
Service-to-service, webhook secrets, one-time tokens
Which Token Format Should You Use?
Answer a few quick questions and we'll point you at the right tool.
What are you building?
JWT vs PASETO vs Opaque vs SAML: Token Format Comparison
| Property | JWT | PASETO v4 | Opaque Token | SAML Assertion | OIDC ID Token |
|---|---|---|---|---|---|
| Structure | header.payload.signature (Base64URL) | version.purpose.payload.footer (Base64URL) | Random bytes (Base64URL/hex) | XML (Base64 + optional DEFLATE) | JWT with OIDC claims |
| Stateful | No (self-contained) | No (self-contained) | Yes (server lookup) | No (self-contained) | No (self-contained) |
| Revocation | Hard (blocklist / short exp) | Hard (same as JWT) | Instant (delete from store) | Hard (short NotOnOrAfter) | Hard (same as JWT) |
| Algorithm Agility | Yes (risk) | No (fixed per version) | N/A | XML Signature (configurable) | JWT algorithms (RS256/ES256) |
| Key Management | JWK / JWKS | PASETO keys (distinct from JWT) | Symmetric key for DB encryption | X.509 certs / metadata | JWKS from provider |
| Payload Visibility | Public (Base64URL decode) | v4.public: public; v4.local: encrypted | Opaque (random) | Public (XML) | Public (JWT decode) |
| Size Overhead | ~100-300 bytes | ~100-300 bytes | Minimal (~32-43 bytes) | Large (XML verbosity) | ~200-500 bytes |
| Best For | Cross-service, stateless, OIDC | Modern apps, crypto-first design | Sessions, revocable, compliance | Enterprise SSO, federation | OIDC login, user identity |
JWT (JSON Web Token) — RFC 7519
Anatomy of a JWT
Structure & Claims
Registered Claims (IANA)
iss— Issuersub— Subject (user ID)aud— Audienceexp— Expiration (Unix timestamp)nbf— Not Beforeiat— Issued Atjti— JWT ID (anti-replay)
Private / Public Claims
- Custom:
role,permissions,tenant_id - Namespaced:
https://example.com/claim - Avoid collisions: use URI format
alg header. Always enforce expected algorithm in verification code. Use PASETO to eliminate this class of vulnerability.Signing Algorithms
| Algorithm | Type | Key | Use Case |
|---|---|---|---|
| HS256/384/512 | HMAC | Shared secret (≥32 bytes) | Single-party, internal services |
| RS256/384/512 | RSASSA-PKCS1-v1_5 | RSA keypair (≥2048 bits) | Cross-service, public verification |
| ES256/384/512 | ECDSA | EC keypair (P-256/P-384/P-521) | Smaller sigs, mobile/IoT |
| PS256/384/512 | RSA-PSS | RSA keypair | Modern RSA (preferred over RS256) |
| EdDSA | Ed25519/Ed448 | Edwards curve keypair | PASETO v4.public, high perf |
HS256 vs RS256 vs ES256: Choosing a JWT Signing Algorithm
HS256 (HMAC-SHA256)
Symmetric signing with a shared secret. Fastest option — ideal for single-service apps, API gateways, and microservices on the same trust boundary. Key must be ≥32 bytes. No support for third-party verification.
RS256 (RSA-SHA256)
Asymmetric signing with an RSA keypair. Anyone can verify with the public key — essential for cross-service auth, OpenID Connect, and third-party integrations. Larger signatures than ES256 but universally supported.
ES256 (ECDSA P-256)
Asymmetric signing with elliptic curve keys. Compact signatures (~64 bytes vs RSA's ~256 bytes) — ideal for mobile tokens, IoT, and constrained environments. Slower signing than HMAC but faster than RSA.
PASETO — Platform-Agnostic Security Tokens
Version 4 (Current)
v4.public — Public Key Signing
- Algorithm: Ed25519 (EdDSA)
- Public verification, private signing
- Payload: visible (like JWT)
- Use: Inter-service auth, OIDC-like flows
v4.local — Symmetric Encryption
- Algorithm: XChaCha20-Poly1305
- Authenticated encryption (AEAD)
- Payload: encrypted (confidential)
- Use: Encrypted cookies, sensitive claims
Opaque Tokens — Server-Side Sessions
Architecture
Generation
- 32+ bytes from CSPRNG
- Base64URL encode for transport
- Store hash (Bcrypt/Argon2) in DB
Validation
- Lookup token hash in Redis/DB
- Check expiry, revocation flag
- Return associated user/session data
Revocation
- DELETE from store = instant
- No blocklist needed
- Supports "logout everywhere"
SAML 2.0 Assertions — Enterprise SSO
Decoding Flow
- Receive Base64 string (HTTP Redirect/POST binding)
- Base64 decode → raw bytes
- Check for DEFLATE compression (zlib header 0x78)
- If compressed: inflate (DEFLATE) → XML
- Parse XML → inspect assertions, conditions, signatures
Key XML Elements
<Assertion/>
Issuer— IdP entity IDSubject/NameID— user identifierConditions/NotBefore/NotOnOrAfter— validity windowAuthnStatement— auth method, timestampAttributeStatement— user attributes (email, roles)
<Signature/> (XML-DSig)
- Enveloped signature (covers Assertion)
- Verify with IdP's public cert (from metadata)
- Check
KeyInfo/X509Data
OIDC ID Tokens — OpenID Connect
Verification Checklist
- Decode header → verify
algis RS256 or ES256 (not HS256, not none) - Fetch JWKS from
jwks_uriin provider metadata (.well-known/openid-configuration) - Match
kidin header to key in JWKS - Verify signature using matched public key
- Validate claims:
issmatches expected provideraudcontains your client_idexp> now (with clock skew tolerance)noncematches your auth request (if used)
Standard Claims
| Claim | Required | Description |
|---|---|---|
| iss | Yes | Issuer URL (HTTPS) |
| sub | Yes | Subject — unique per issuer |
| aud | Yes | Audience — your client_id(s) |
| exp | Yes | Expiration (Unix timestamp) |
| iat | Yes | Issued at |
| auth_time | No* | When user authenticated (*if max_age requested) |
| nonce | No* | Opaque value from auth request (*required if sent) |
| email, name, picture | No | Profile claims (scope-dependent) |
Common Workflows
Debug Failed JWT Auth
- Paste token in JWT Decode
- Check
expvs now (clock skew?) - Verify
audmatches your client_id - Check
issmatches expected provider - If RS256: use OIDC ID Token to auto-fetch JWKS
Migrate JWT → PASETO
- Generate Ed25519 keypair (PBKDF2 for key derivation if needed)
- Update issuer to sign v4.public
- Update consumers to verify with PASETO lib
- Run both in parallel during transition
- Deprecate JWT after full rollout
Generate Secure API Key
- Open Opaque Token Generator
- Generate 32-byte (256-bit) token
- Hash with Bcrypt cost 12 (Bcrypt Hash)
- Store hash in DB with prefix
sk_live_ - Return raw token ONCE to user
Debug SAML Login Loop
- Capture SAMLResponse from browser (Network tab)
- Paste in SAML Decoder
- Check
NotOnOrAfterhasn't passed - Verify
Audiencematches SP entity ID - Confirm
NameIDformat matches SP expectation - Verify signature with IdP cert
Add "Login with Google" (OIDC)
- Register app in Google Cloud Console
- Get client_id, client_secret, redirect_uri
- Redirect user to Google's auth endpoint with
scope=openid email profile - Receive
codeat redirect_uri - Exchange code for tokens at token endpoint
- Verify ID Token with OIDC ID Token tool
Implement Token Refresh
- Issue short-lived access token (15-30 min)
- Issue long-lived refresh token (opaque, 30-90 days)
- Store refresh token hash in DB (Bcrypt)
- On 401: POST refresh_token to /token endpoint
- Rotate: issue new access + refresh, revoke old
- Detect reuse → revoke entire session (theft detection)
Security Checklist
- Never put secrets in JWT claims — payload is public (Base64URL decode). Use opaque tokens or PASETO v4.local for confidential data.
- Always verify signatures — decode ≠ verify. Use JWT tool (HS256) or OIDC tool (RS256/ES256 + JWKS).
- Enforce algorithm — hardcode expected
algin verification code. Rejectnoneand unexpected algorithms. - Use short expirations — access tokens ≤30 min; refresh tokens ≤90 days with rotation.
- Validate audience — reject tokens not issued for your
client_id. - Rotate keys — publish new JWKS, overlap validity, retire old keys after grace period.
- HTTPS only — tokens in transit must be encrypted (TLS 1.2+).
- Secure storage — HttpOnly Secure SameSite cookies, or memory-only for SPAs (never localStorage).
Frequently Asked Questions
JWT (RFC 7519) lets you negotiate algorithms in the header via the alg parameter. This has led to algorithm confusion attacks over the years.
PASETO (Platform-Agnostic Security Tokens) takes a different approach. It uses versioned protocols with fixed algorithms per version. For example, v4.public always uses Ed25519, and v4.local always uses XChaCha20-Poly1305. This eliminates algorithm agility vulnerabilities entirely.
PASETO also enforces key separation and has a simpler, more opinionated design. You get fewer ways to shoot yourself in the foot.
See these differences hands-on in the JWT vs PASETO Playground — feed in one payload and key, then watch both token types generated side by side with live byte-size counts and timing.
Related Tools — Explore the Full Toolchain
Serializing token payloads? Learn about Protobuf →
Password storage & salting with Bcrypt, Argon2, scrypt
Hex/base64 representation of hash digests
Base64URL in JWT
Protobuf for efficient token payload serialization