A JWT decoder can make authentication failures easier to diagnose, but decoding is only the first step. This guide presents a safe workflow for inspecting a token’s structure and claims, checking expiration and issuer values, and verifying the signature without treating unverified data as trustworthy.
Overview
JSON Web Tokens, usually called JWTs, are compact strings used to carry claims between systems. They commonly appear in OAuth and API authentication flows, where a client sends a token in an HTTP Authorization header such as Bearer eyJ.... A JWT is typically made of three Base64URL-encoded parts separated by periods:
header.payload.signature
The header describes the token, including its signing algorithm and token type. The payload contains claims such as the subject, issuer, audience, issue time, and expiration time. The signature allows a verifier to determine whether the signed content was changed and whether it was signed with a trusted key.
A browser-based JWT decoder or local command-line utility can decode the header and payload because those sections are encoded rather than encrypted. Decoding does not prove that a token is genuine, current, intended for your application, or safe to authorize. Treat every decoded claim as untrusted until your application or an appropriate verification tool validates it.
This distinction is the foundation of useful JWT debugging: use a decoder to understand what a token says, then use the issuer’s keys and your application’s validation rules to determine whether the token should be accepted.
Step-by-step workflow
1. Obtain a safe test token
Start with a token from a local, development, or intentionally redacted environment whenever possible. Avoid pasting production access tokens into an online utility, ticket, chat message, screenshot, or shared log. Even if a tool says it processes data in the browser, review how it works before using sensitive material. A token may grant access until it expires or is revoked, and its claims can reveal internal identifiers or account information.
Before decoding, remove the Bearer prefix and surrounding whitespace if the utility expects only the JWT string. Preserve the periods and do not alter the token’s characters.
2. Inspect the structure and header
Confirm that the value has three dot-separated segments. Decode the first segment as JSON and inspect fields such as:
alg: the algorithm identifier used for signing.typ: often a value indicating a JWT, although applications should follow their own validation rules.kid: a key identifier that may help the verifier select the correct public key.
The header is useful for debugging key selection and configuration, but never let an untrusted token choose security behavior on its own. The accepted algorithms and key sources should be configured by the verifying application.
3. Review JWT token claims
Decode the payload and record the claims that your service expects. Common registered claims include:
iss(issuer): the system that issued the token.aud(audience): the service or services for which the token is intended.sub(subject): the user, service, or entity represented by the token.exp(expiration): the time after which the token should not be accepted.nbf(not before): the time before which the token should not be accepted.iat(issued at): the time at which the token was issued.scopeorroles: application-specific authorization information.
Check the data type as well as the value. For example, aud may be represented as a string or an array, depending on the issuer and library. Unix timestamps such as exp and iat are commonly displayed as seconds since the Unix epoch, but your validation library should define the interpretation.
4. Check expiration and time assumptions
Use a JWT expiration checker or a local date conversion to compare exp with the verifier’s current clock. Also check nbf and consider a small, explicitly configured clock tolerance where your platform requires it. A token that is not expired can still be invalid if it has the wrong issuer, audience, signature, or authorization scope.
5. Verify the signature separately
Signature verification requires the correct cryptographic key and the exact signing input. For asymmetric signing, the verifier generally needs the issuer’s trusted public key, often selected using kid. For symmetric signing, it needs the shared secret, which must never be pasted into an untrusted online tool.
Verification should be performed by the service or a trusted local tool configured with an expected algorithm, issuer, audience, and key source. A successful signature check confirms integrity under that key; it does not automatically confirm that the token is authorized for every operation.
Tools and handoffs
Different developer utilities serve different parts of the workflow:
- JWT decoder: Use it to view the header and payload in readable JSON. It is an inspection aid, not an authorization decision.
- JSON formatter: Use a formatter to compare nested claims, identify missing fields, and make long payloads easier to review.
- Base64URL decoder: Use it to understand the encoding of JWT segments. Base64URL is not encryption.
- API debugging tool: Use a local or approved request client to reproduce the request, inspect the response, and confirm which service rejected the token.
- Application logs and identity-provider logs: Correlate timestamps, issuer configuration, key identifiers, and validation errors without recording complete bearer tokens.
A practical handoff is to pass findings rather than secrets. For example, report that the token had an audience mismatch, an expired exp value, or an unrecognized kid. If authorization design is also under review, document how roles, attributes, and scopes map to permissions. The guidance in implementing role-based and attribute-based access control can help separate identity verification from authorization decisions.
Quality checks
Before concluding that a JWT is valid, run through this checklist:
- Does the value contain the expected number of segments and valid JSON in the decoded sections?
- Is the algorithm allowed by the verifier’s configuration?
- Was the signature checked with a trusted, appropriate key?
- Does
issexactly match the expected issuer? - Does
audidentify the service receiving the token? - Is the current time between
nbfandexp, subject to documented clock tolerance? - Is the token’s subject active and permitted to perform the requested action?
- Are scopes or roles sufficient for this endpoint, rather than merely present?
- Have complete tokens, secrets, and personal data been excluded from logs and support messages?
Do not infer validity from a plausible-looking payload. Do not edit a decoded payload and expect the original signature to remain valid. Do not use a JWT decoder as a substitute for server-side validation, access control, key rotation procedures, or token revocation handling.
When to revisit
Revisit this workflow whenever an identity provider, API gateway, authentication library, key set, or token policy changes. A change from one signing algorithm to another, a new audience value, a different claim type, or a rotated key can produce failures that look similar in an application log but require different fixes.
Review the process after adding a new service, changing clock synchronization, introducing multiple issuers, or moving authentication across cloud and on-premises environments. Also revisit it when a browser-based JWT decoder changes its privacy model, supported encodings, or verification features. Tool capabilities evolve, but the safety boundary remains constant: decode for inspection, verify with trusted configuration, and authorize only after all required checks pass.
For the next JWT-related incident, use a non-production token, capture the header and relevant claim names, record the expected issuer and audience, compare expiration and key identifiers, and reproduce the request with an approved local tool. Finish by documenting the validation failure and the corrective configuration rather than storing the token itself.