Skip to content

Category · 1 tool · 1 guide

JWT, auth and security tools

Authentication is where small mistakes become incidents. Login flows, session tokens, API keys, OAuth redirects and signed webhooks all depend on getting exact details right: the algorithm, the secret, the expiry time, the audience, the clock on the server. When something fails, the error is usually a terse 401 that hides the real reason.

JSON Web Tokens are the most common credential format you will debug. A JWT is readable by anyone, so you can learn a lot by decoding it: who issued it, who it is for, when it expires and which algorithm signed it. Verifying the signature with the right key tells you whether the token is genuine or was changed.

Because tokens and secrets grant real access, tools in this category run entirely in your browser. Nothing you paste is logged or sent to a server. Even so, prefer test tokens over production ones whenever you can.

Tools in this category

Common tasks

Key concepts

JWT
A JSON Web Token has three Base64URL parts separated by dots: a header, a payload of claims and a signature. The header and payload are only encoded, not encrypted, so never put secrets in them.
Claims
The fields in the payload. Registered claims include iss (issuer), sub (subject), aud (audience), exp (expiry), nbf (not before) and iat (issued at). Times are Unix timestamps in seconds.
HS256 vs RS256
HS256 signs with a shared secret, so every service that verifies tokens can also create them. RS256 and ES256 sign with a private key and verify with a public key, which suits tokens checked by many services.
Clock skew
Servers rarely have perfectly synced clocks. Validators usually allow a leeway of 30 to 60 seconds on exp and nbf so a freshly issued token is not rejected as "not yet valid".
alg: none
An unsigned token type allowed by the spec. Libraries must reject it, and must not let the token header choose the algorithm, or attackers can forge tokens.

Best practices

  1. Pin the expected algorithm when verifying tokens; never trust the alg value in the token header alone.
  2. Keep access tokens short-lived, around 5 to 15 minutes, and use refresh tokens or sessions to get new ones.
  3. Always validate exp, iss and aud, not just the signature. A valid signature on a token meant for another service is still the wrong token.
  4. Use secrets of at least 256 random bits for HMAC algorithms and rotate them with a key ID (kid) so old and new keys can overlap.
  5. Store browser tokens in HttpOnly, Secure cookies where possible to keep them away from injected scripts.

Guides