consolelog.tools

Bearer Token Generator

Generate HS256-signed JWT bearer tokens with a custom payload — decoded preview, human-readable expiry, and security warnings.

About this ToolHow it works, benefits & use cases

Generate a bearer token online: this tool mints a signed, JWT-style token ready to paste into an Authorization: Bearer header while you test an API. Write any JSON payload — sub, iss, aud, scope, role, or your own custom claims — and the tool adds an iat (issued-at) timestamp, a random jti, and an exp expiry if you set one. Tokens are signed with HS256 (HMAC-SHA256) using a secret you provide, or you can pick "none" for an unsigned token. Signing happens entirely in your browser via the Web Crypto API, so the secret you type never leaves your machine. After generating, you see the token string, its expiry in human-readable form, and the fully decoded payload. A warnings panel flags weak or default secrets, unsigned tokens, missing expiry, and over-long lifetimes — the kinds of mistakes that are fine for a test fixture but dangerous in production.

How to Use

  1. 1Set "Expires in (seconds)" — for example 3600 for one hour, or 0 for a token that never expires.
  2. 2Choose the Algorithm: HS256 (HMAC-SHA256) to sign with your secret, or none for an unsigned token.
  3. 3Enter a Secret key (used only for HS256 signing) — it stays in your browser.
  4. 4Edit the Payload (JSON) with your claims, or click "Load example" for a sample sub/iss/aud/scope/role payload.
  5. 5Click "Generate token", then copy the token, read the human-readable expiry, review any security warnings, and inspect the decoded payload.

Key Benefits

  • Signs HS256 (HMAC-SHA256) tokens entirely in the browser with the Web Crypto API
  • Accepts any custom JSON payload; auto-adds iat, a random jti, and exp when an expiry is set
  • Configurable expiry in seconds, including 0 for no expiry
  • Shows the token, a human-readable time-to-expiry, and the decoded payload
  • Security warnings for unsigned tokens, weak/default secrets, missing or very long expiry
  • Optional unsigned "none" algorithm for testing scenarios that require it
  • Your secret and payload never leave your machine — no server round-trip

Common Use Cases

  • Crafting an access token to test a protected endpoint from curl, Postman or a test suite
  • Generating a fixture token with specific claims (role, scope, sub) for integration tests
  • Reproducing a token shape your backend expects while building a client
  • Demonstrating JWT structure and expiry behaviour to a teammate learning auth
  • Quickly producing a short-lived token to exercise expiry handling in your code

Test-only values.Tokens are signed client-side; any secret you type is not sent anywhere. Don't use these in production without proper key management.

Options

0 = no expiry

Used to sign the token when algorithm is HS256

Payload (JSON)
Generated token will appear here.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related guide

Related tools