A JWT decoder can quickly reveal why an authentication request is failing, but decoding is not the same as validating. This guide explains the three-part token structure, provides a reusable debugging checklist for common scenarios, and shows how to inspect claims without exposing credentials or treating untrusted token data as proof of identity.
Overview
JSON Web Tokens are compact strings commonly used to carry signed claims between an identity provider, an application, and an API. A typical signed JWT has three Base64URL-encoded parts separated by periods:
header.payload.signature
The header usually identifies the token type and signing algorithm. The payload contains claims such as the subject, issuer, audience, and expiration time. The signature is generated from the header and payload using a key. It allows a verifier to detect whether the signed content has been altered.
Decoding the first two parts only transforms encoded data into readable JSON. It does not confirm that the token came from a trusted issuer, has not been modified, or is still valid. A browser-based JWT decoder or local command-line utility is therefore useful for inspection, not for making an authorization decision.
Before using a decode JWT online tool, remove tokens from production sessions whenever possible. A bearer token may be usable by anyone who obtains it, even if the token payload contains no password. Prefer a local JWT decoder for sensitive material, and never paste a live access token into an unfamiliar service, issue tracker, chat room, or screenshot.
Common JWT claims
| Claim | Meaning | Debugging question |
|---|---|---|
iss | Issuer identifier | Does it match the issuer configured by the receiving service? |
sub | Subject identifier | Does it identify the expected user, service, or account? |
aud | Intended audience | Does it match the API or client checking the token? |
exp | Expiration time | Has the token expired according to the verifier's clock? |
nbf | Not-before time | Is the token being used before it becomes valid? |
iat | Issued-at time | Was it issued when expected, and is the timestamp in seconds? |
jti | Token identifier | Is it useful for replay tracking or revocation in this system? |
These claims are conventions rather than a complete authorization policy. Applications may add private claims for roles, scopes, tenant identifiers, or feature access. The receiving service must still apply its own validation and authorization rules.
Checklist by scenario
When an API returns an authentication error
- Confirm that the request sends the intended token and not a stale value from browser storage, an old environment variable, or a copied terminal session.
- Decode the header and payload locally or with a trusted JWT decoder. Check that the token has three expected segments and that both readable sections contain valid JSON.
- Compare
isswith the API's configured issuer, including differences in hostnames, paths, and trailing slashes. - Compare
audwith the audience expected by the API. A token issued for a web client may not be accepted by a separate resource server. - Check
expandnbfagainst the current time. Treat a time-zone or clock problem as a separate issue; JWT numeric date values are normally interpreted as seconds since the Unix epoch. - Confirm that the token includes the required scope, role, permission, or tenant claim. A valid token can still fail authorization.
When signature verification fails
- Record the algorithm shown in the header, but do not accept it solely because the token declares it. The verifier should allow only algorithms configured for that issuer and key set.
- Check that the verifier is using the correct public key or secret for the environment. Development, staging, and production often use different signing material.
- Inspect key-selection fields such as
kidwhen the issuer publishes multiple keys. A missing, unknown, or outdated key identifier can prevent verification. - Check whether the token was altered during transport, copying, logging, or manual editing. One changed character invalidates a signature.
- Verify that the library expects the same token type. A signed JWT and an encrypted JWT do not expose the same debugging workflow.
When comparing tokens across environments
- Compare headers first: algorithm, token type, and key identifier.
- Compare issuer and audience values before comparing user claims.
- Check timestamp units and the relative lifetime of each token.
- Compare scopes, roles, tenant identifiers, and subject formats.
- Confirm that each environment's verifier points to the intended key-discovery endpoint or configured key set.
What to double-check
Separate three questions during JWT authentication debugging: Can the token be decoded? Can its signature be verified? Is the verified identity authorized for this operation? A failure at one stage should not be explained by evidence from another.
For time-related errors, inspect the raw numeric values as well as the displayed date. Check the system clocks on the client, API, identity provider, and any gateway between them. A small permitted clock-skew window may be configured by a library, but do not assume that every verifier handles skew the same way.
For audience and issuer failures, compare exact values rather than treating them as labels. Configuration can differ by environment, protocol, tenant, or API version. A token can be correctly signed by a trusted issuer and still be inappropriate for the endpoint receiving it.
For signature errors, verify key rotation behavior. An issuer may publish more than one valid key while consumers transition between them. The consumer should obtain keys through its approved configuration and handle refreshes according to its library and deployment design; manually replacing keys during an incident can create a second problem.
For privacy, redact or destroy diagnostic copies after the investigation. Do not log complete bearer tokens. If a live credential was exposed, follow the application's established revocation or replacement procedure rather than assuming that changing a payload value will make it safe.
Common mistakes
- Confusing Base64URL with encryption: The header and payload of a signed JWT are readable by design. Encoding does not make claims secret.
- Trusting decoded claims: A person can create a token-shaped string with an administrator role. Claims matter only after signature, issuer, audience, time, and policy checks succeed.
- Changing the algorithm to make verification pass: The verifier must enforce an explicit, appropriate algorithm policy. Never use a decoder result as permission to weaken that policy.
- Checking only expiration: A token that is not expired may still have the wrong audience, issuer, scope, tenant, or signing key.
- Assuming a 401 and 403 mean the same thing: A system may use one response for missing or invalid authentication and another for an authenticated identity lacking permission. Confirm the service's documented behavior and logs.
- Debugging the wrong token: Multiple browser tabs, refresh tokens, cookies, and authorization headers can make it easy to inspect one credential while the failing request sends another.
- Putting sensitive tokens into third-party tools: Free or browser-based developer tools can be convenient, but convenience does not remove the credential-handling risk.
When to revisit
Use this checklist whenever an access token is rejected, an API moves between environments, an identity provider changes configuration, or a signing key is rotated. Revisit it before seasonal planning or major deployment cycles as well, especially if authentication settings are maintained separately by different teams.
Update your team runbook when the JWT library, identity provider, gateway, key-discovery process, or claim conventions change. Record the expected issuer, audiences, algorithms, scopes, clock-skew approach, and safe diagnostic procedure without recording real credentials. A short redacted example token can help explain structure, but it should never be copied from a live session.
For the next incident, work in this order: preserve the error and request context, identify the exact token, decode it without sharing the secret, check issuer and audience, check timestamps, verify the key and algorithm configuration, then inspect authorization claims. If you need broader workflow context, pair this guide with the Browser Storage Debugging Guide for client-side credentials or the JavaScript Date and Time Debugging Guide for timestamp problems. That sequence keeps a JWT decoder in its proper role: a precise inspection aid, not a substitute for cryptographic verification or access control.