LanguageEnglish
Build →

Guides · QuorumAuth

How to revoke a JWT before it expires

A JWT is valid until its exp claim, wherever it is checked, unless something tells every verifier otherwise. Here are the four ways teams make a token stop working early, and the details that decide whether it actually stops.

Updated

The problem: the token outlives your decision

You found an access token in a public log. Or a contractor left an hour ago, and their session token is good until tomorrow morning. You delete the session in your database, and nothing changes: your APIs verify the JWT’s signature and exp claim on their own, which is the whole point of a JWT, and neither has changed.

Signed tokens are fast because verifiers do not ask anyone. That same property means a revocation only counts once every verifier knows about it, including the ones that cannot reach the issuer at that moment.

Four ways to stop a token early

Approach How fast it bites What it costs
Short lifetime plus refresh When the token expires Nothing to revoke: the window just shrinks
Introspect every request Immediately A network call per request, and an outage when the issuer is down
Revocation list held by verifiers When the list reaches the verifier Distribution, ordering and memory
Withdraw the signing key When verifiers drop the key Every token that key signed, for everyone

Four ways to stop a token early

  1. Withdraw the signing key
    Ends every token it signed; for key compromise only
  2. Stream a revocation list
    Verifiers refuse listed tokens and still verify locally
  3. Introspect every request
    Immediate, but the issuer sits on every call
  4. Short lifetime and refresh
    Limits the window; the token still works until exp

Four stacked options. Short lifetimes with refresh limit damage but leave the token valid until it expires. Introspecting every request revokes at once but puts the issuer on every call. A revocation list streamed to verifiers revokes early while verification stays local. Withdrawing the signing key ends every token it signed, for every user.

Each layer trades a different cost for a shorter window.

Most teams combine the first and third: short lifetimes so the list stays small, and a list so the window is not the only defence. Key withdrawal is the emergency brake; see what happens to verifiers after a key is withdrawn.

What a revocation list has to get right

  • Reach every verifier. A list in your database helps only the services that query it. Push it to the verifiers, and have them keep it.
  • Survive a lost connection. A verifier that loses its link must keep refusing what it already knows is revoked.
  • Stay in order. Revocations applied out of order leave a window where the wrong state wins.
  • Expire entries. An entry only matters until its token’s exp. Carry the expiry with each entry so the list does not grow forever.
  • Fail closed, and say why. When a verifier cannot establish revocation state, refuse, and report “unavailable” rather than “revoked”.
  • Decide who may revoke. The holder should be able to end its own session; an administrator should be able to end a member’s; nobody should be able to end a session in another organization.

How QuorumAuth revokes a token

QuorumAuth streams revocations to its SDK, which verifies tokens in your service’s own process. In its tested behaviour:

  • Revoked means refused. Once the SDK learns of a revocation, it rejects that token, and tokens that were not revoked keep verifying.
  • Even offline. A revoked token is refused by an SDK that cannot reach the authority.
  • An ordered feed with expiries. Revocations arrive on the feed in the order they were made, and each names when its token expires.
  • Unknown is not revoked. When the SDK cannot establish revocation state, verification fails as unavailable, and does not report the token as revoked. A freshly connected SDK, or one whose feed has been quiet, still verifies without making the caller wait.
  • Clear authority to revoke. A holder can end its own session, and an organization administrator can end a member’s, but not one in another organization. A credential narrowed from a session cannot end the session it came from.
  • Sign out everywhere. An administrator can sign a member out everywhere, and the member’s earlier session is refused.
  • Machine credentials too. Rotating a service account’s key, revoking the account or removing its role ends the sessions it had already opened, not just the next sign-in. If you are replacing long-lived keys, see service accounts without an API key.

The machine-to-machine authentication platform page shows how those tokens are issued in the first place.

Revocation that reaches an offline verifier

  1. 1Administrator → AuthorityRevoke this token
  2. 2Authority → ServiceRevocation feedIn order, with the token's expiry
  3. 3Service → ServiceConnection to authority lost
  4. 4Service → ServiceRevoked token refusedStill offline

A sequence between an administrator, the authority and a service verifying tokens locally. The administrator revokes a token. The authority announces it on the revocation feed with the token's expiry. The service records it. Later the service loses its connection to the authority, a request arrives with the revoked token, and the service still refuses it.

The verifier keeps refusing a revoked token even when it cannot reach the authority.

Revocation covers tokens QuorumAuth issued, not tokens from another provider. It does not make a verifier that skips the SDK, or ignores the feed, refuse anything: revocation is only as good as the verifiers that apply it.

Where to go next

Set token lifetimes short enough that your revocation list stays small, then check that every verifier holds the list rather than querying a database. For tokens a service can narrow before passing them on, read about Biscuit tokens.

Can you revoke a JWT at all?

Not by changing the token. A signed JWT stays valid until it expires. You revoke it by making every verifier refuse it, through short lifetimes, a call to the issuer, or a revocation list the verifiers hold.

Does logging out invalidate a JWT?

Only if your verifiers learn about it. Deleting the token from the browser stops honest clients, not a copy someone else holds.

Should I rotate the signing key to revoke one token?

Only in an emergency. Withdrawing the key ends every token it signed, for every user, which is the right call after a key compromise and the wrong one for a single leaked token.

What should a verifier do when it cannot get revocation data?

Refuse the token, and say that revocation state was unavailable rather than that the token was revoked, so the alert and the retry are the right ones.

Talk to sales about QuorumAuth.

QuorumAuth is sold through our sales team. The Build page shows the drop-in sign-in on your origin and how to reach sales about your stack.

Go to Build and contact sales →