Create and sign a test JWT

Write the claims as JSON, choose an HMAC algorithm and a test secret, and get a signed JSON Web Token — with iat and exp added if you want the token to expire. It is the quickest way to produce tokens for negative tests: expired, wrong audience, wrong issuer or signed with the wrong key. Signing happens with the browser's Web Crypto API.

Test secrets only

Use a secret made for testing. A real signing key pasted into any web page, this one included, should be treated as exposed and rotated. The page warns when a secret is shorter than the hash output, which is the minimum key size the JWT security best practices call for.

Tokens worth generating

One that expired a minute ago, one valid but for another audience, one signed with a different secret, and one with alg none — four tokens that each must be rejected. An API that accepts any of them has a security bug, not a test failure.

Why only HMAC

RS256 and ES256 need a private key, and the sensible place for a private key is not a web page. For asymmetric tokens, issue them from your identity provider's test tenant, or from the Auth Playground here.

Other tools

All tools · Getting started guide · All 55 mock REST APIs

Last updated