Document Workflow

Decode a JWT safely before debugging authentication

Learn how to inspect JWT headers and payload claims without treating decoded tokens as verified or sharing secrets by accident.

Written and tested by Published: Reviewed:

How this workflow was checked

The review loaded the unmodified “JWT payload with expired access” sample into JWT Decoder: Inspect Claims and Expiration. We exercised the path from “Redact sensitive values first” to “Verify elsewhere before trusting it”, checked the displayed or downloaded result against the example, and separately examined “Assuming decoded means verified” and “Pasting the whole Authorization header”.

The payload exposed sub, scope, aud, and exp exactly as encoded, while the result continued to label the claims unverified and the sample expiration as past.

Problem

JWTs are compact and easy to paste into logs, but the decoded payload can contain user identifiers, scopes, tenant IDs, session data, and expiry times. Decoding helps debugging authentication problems, but decoding is not the same as verifying a signature or proving that the token is safe to trust.

Sources and standards

These authoritative references define the formats or security boundaries used in this workflow. Tool-specific verification is documented separately above.

When to use this

  • An API returns 401 or 403 and you need to check token expiry or audience.
  • A role or scope appears missing after login.
  • A support case includes a redacted token and you need to inspect non-secret claims.
  • A staging token works in one environment but fails in another and you need to compare issuer, audience, and tenant claims.
  • You need to confirm whether a request used an access token, ID token, or refresh-related value in the wrong place.

Steps

  1. Step 1

    Redact sensitive values first

    Remove or replace token values before sharing them in tickets, screenshots, chat, or documentation.

  2. Step 2

    Identify token type and environment

    Confirm whether the token came from development, staging, or production, and whether it is intended for an API, browser session, identity claim, or refresh flow.

  3. Step 3

    Decode header and payload

    Open the token locally and inspect algorithm, key identifier, issuer, audience, subject, expiry, and scope claims.

  4. Step 4

    Check time-based claims

    Compare exp, nbf, and iat values against the machine or server clock involved in the failed request.

  5. Step 5

    Verify elsewhere before trusting it

    Use your application, identity provider, or backend library to verify the signature before treating the token as authentic.

  6. Step 6

    Map claims back to the failed request

    Compare the decoded audience, issuer, scopes, roles, and tenant identifiers with the API route, environment, and permission check that rejected the request.

Example

JWT payload with expired access

Input

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzQyIiwic2NvcGUiOiJyZWFkOmJpbGxpbmciLCJhdWQiOiJhcGkiLCJleHAiOjE3MDAwMDAwMDB9.c2lnbmF0dXJl

Output

{
  "sub": "user_42",
  "scope": "read:billing",
  "aud": "api",
  "exp": 1700000000
}

Common mistakes

Assuming decoded means verified

Anyone can Base64URL-decode a JWT payload. Verification requires checking the signature and claims with trusted keys.

Sharing real production tokens

Access tokens can grant live permissions. Redact or use a test token before posting decoded claims anywhere.

Pasting the whole Authorization header

Copy only the token value after Bearer. Extra header text, surrounding quotes, or line breaks can make a valid token look malformed in a decoder.

Trusting the alg value from an unverified token

The JWT header is also user-supplied data until the signature is verified. Do not choose verification behavior solely from the decoded alg field.

Debugging with a token from the wrong environment

A token from staging can decode correctly but fail against production because issuer, audience, key set, tenant, or clock settings differ.

Confusing access tokens and ID tokens

An ID token may describe a signed-in user, while an access token is usually what an API expects. Decode the claims, then confirm the token type against your identity provider's docs.

FAQ

Is it safe to decode a JWT?

Decoding is safe as a local inspection step, but you should not share real tokens or treat decoded claims as trusted without signature verification.

Why does my token decode but still fail authentication?

The token may be expired, signed by the wrong issuer, intended for another audience, missing required scopes, or failing signature verification.

Can a JWT decoder validate permissions?

A decoder can show permission-related claims, but your backend or identity provider must decide whether those claims are valid for a request.

Which JWT claims should I check first?

Start with exp, nbf, iss, aud, sub, scope, roles, and tenant or organization identifiers. These usually explain expired sessions, wrong environment tokens, and missing permissions.

Can I use decoded claims for frontend authorization?

Use decoded claims only for debugging or display hints. Real authorization decisions should happen on the server after signature, issuer, audience, expiry, and scope checks.

What should I redact before sharing decoded JWT details?

Remove the raw token, subject identifiers, emails, tenant IDs, organization IDs, session IDs, and any custom claims that reveal internal account structure.

What is the difference between decoding and verifying a JWT?

Decoding only reads the header and payload. Verification checks the signature, issuer, audience, expiry, and related rules with trusted keys before the token is accepted.