Create a signed JSON Web Token by writing the header and payload and choosing an algorithm. HS256 uses a shared secret, while RS256, ES256 and EdDSA sign with a private key. Generated tokens are handy for testing APIs and middleware without standing up a login flow.
Common uses
- Checking why an API rejects a token: expired, wrong audience or bad signature
- Reading the claims in an access token during development
- Minting a test token with specific claims for a staging environment
Frequently asked questions
- Should I use these tokens in production?
- No. They are meant for testing. Production tokens should be issued by your auth server with properly managed keys.
- What claims should I include?
- Commonly iss, sub, aud, iat and exp. Setting an expiry limits the damage if a token leaks.