Platform

Platform overview How it works Authorization testing Evidence & reports Private scanning Integrations

Solutions

Security agencies Product teams Regulated industries Partner programme

Learn

Blog Knowledge hub Compare

Resources

Pricing Documentation Help centre FAQ Security & data What we haven’t proved

Company

About Contact Careers Sign in to the platform Start a $199 pilot →

Home / Knowledge hub / JWT expiry

Knowledge hub

JWT expiry

The time claim that stops a signed token from being accepted forever.

Illustration explaining JWT expiry

What it means

JWT expiry is set by the exp claim, a time given in seconds since 1 January 1970. RFC 7519 says a token must not be accepted on or after that moment. It is part of the signed content, so nobody can extend it without breaking the signature.

Two related claims help. iat records when the token was issued, and nbf sets when it first becomes valid. Together they define a window in which the token is acceptable.

Why it matters

A JWT is checked by signature alone, so it keeps working until it expires. If the expiry is missing, set years ahead or never checked, a token stolen once works indefinitely. The signature will still be perfectly valid.

Expiry is also the main way you cancel a stateless token, since the server keeps no record. A short life limits the harm of any leak. A long one turns every leak into a long-running problem, and revocation becomes the only brake.

How it shows up

You meet it in the payload of every access token and ID token. Libraries check it for you by default, but not always, and not for hand-written decoding. Some also allow a few seconds of clock skew, which is fine, while minutes of leeway is not.

The mistakes repeat. A token with no exp that the server happily accepts. Decoding without verifying. Expiry set to a year "for convenience". Refresh tokens that never expire. Servers whose clocks drift. Check that a token one second past expiry is refused.

Questions people ask

JWT expiry, answered

How long should a JWT live?

Access tokens typically live for minutes up to an hour. The right figure depends on how much harm a stolen token could do.

Pair a short access token with a revocable refresh token for longer sessions.

What happens if a JWT has no exp claim?

RFC 7519 makes exp optional, so a library may accept a token without one. Such a token is valid forever.

Configure your verifier to require the claim.

Can a user change the exp claim?

Not without breaking the signature, unless your server fails to verify it properly. See algorithm confusion.

So expiry is only as strong as the verification.

Is clock skew a problem?

Small differences between servers are normal, so libraries allow a leeway of a few seconds. Keep it small.

Keep clocks synchronised with NTP.

How do we test expiry?

Take an expired token, and one with the claim removed, and send both to the API. Both should be refused.

A pentest does this against every endpoint and shows which ones accept them.

Cyberlop mark

Is an expired token refused everywhere?

Expired tokens, tokens with no expiry and endpoints that skip the check are things we try on the running app, and a finding shows the request that was accepted. Book a pilot on one app.

Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.