Scrivio Interview library
ConceptFoundations6 min read · updated 12 November 2026

Why are access tokens usually short-lived while refresh tokens live longer? What is refresh token rotation and what does reuse detection add?

Access tokens are short-lived because a stolen JWT usually cannot be revoked, so its lifetime is the damage window. Refresh tokens live longer but are sent only to the authorization server, which can check and revoke them. Rotation issues a new refresh token on every use and invalidates the old one, and reuse detection treats a second use of an old refresh token as theft and revokes the whole token family.

Why this question is asked

Every application that uses OAuth 2.0 or OpenID Connect has to pick token lifetimes, and the choice affects both security and how often users are asked to sign in. Interviewers ask this question to see whether we understand the reason behind the usual numbers rather than just repeating them. In this answer, we will recap the two token types, see why their lifetimes differ, walk through refresh token rotation with an example, and see how reuse detection catches a stolen token. We will finish with why public clients such as mobile apps and single-page apps need extra care.

1A Quick Recap of Access and Refresh Tokens

An access token is what the client sends with each API call, usually in the Authorization header as Bearer followed by the token. It is often a JWT, a signed token that the API can check on its own using the issuer's public key, without calling anyone. That self-contained check is what makes JWTs fast.

A refresh token is a second credential the client receives at sign-in. The client never sends it to APIs. When the access token expires, the client sends the refresh token to the authorization server (the service that issues tokens, such as Keycloak, Okta or Spring Authorization Server) and gets a new access token back.

2Why the Access Token Is Short-Lived

Because an API validates a JWT locally, it has no way to know that the token was stolen or the user was disabled. As long as the signature is valid and exp is in the future, the token works. Revoking it would need extra state, such as a deny list that every API checks, which removes much of the benefit of local validation.

So the lifetime itself is the safety mechanism. If an access token lives 10 minutes and is copied from a log file, the attacker has at most 10 minutes. If it lived 30 days, they would have 30 days. The usual range is 5 to 15 minutes, chosen so that the damage window is small and the refresh traffic is still modest.

3Why the Refresh Token Can Live Longer

The refresh token goes to one place only, the authorization server, and that server keeps state about it. When it receives a refresh token, it can check whether the token was revoked, whether the user still exists and whether the session hit its limits. So a long-lived refresh token is not uncontrolled the way a long-lived JWT would be: every use is a checkpoint.

It is also exposed far less. An access token travels to every API, through gateways and proxies, into request logs. A refresh token travels only between the client and the authorization server, over one connection. Typical lifetimes are hours to days for web apps and weeks to months for mobile apps, usually with an idle limit as well.

Access token versus refresh token
Access tokenRefresh token
Sent toEvery API callAuthorization server only
Checked byAPI, locally (signature, exp)Authorization server, with state
RevocableNot easilyYes, on each use
Typical lifetime5 to 15 minutesHours to months
If stolenDamage until expCaught by rotation and reuse detection

4Refresh Token Rotation, Step by Step

With rotation, every refresh returns a new refresh token along with the new access token, and the old refresh token stops working. The client stores the new one and throws the old one away.

Here is a short exchange. The client signs in and receives refresh token R1. Ten minutes later it calls the token endpoint with R1.

Java
POST /oauth2/token
grant_type=refresh_token&refresh_token=R1&client_id=mobile-app
200 OK
{ "access_token": "eyJ...A2", "expires_in": 600, "refresh_token": "R2" }
// R1 is now used; R2 is the only valid refresh token in this family

Notice that the server tracks R1 and R2 as one family, the chain of refresh tokens that started at one sign-in. The point of rotation is that a refresh token can be used once. A thief who copies R1 after it was used gets nothing, and a thief who copies the current token sets up a race that reuse detection can catch.

5What Reuse Detection Adds

Suppose an attacker steals R2 and uses it first. They get R3. Later the real client tries to refresh with R2, which it still holds. The server sees that R2 was already used. It cannot tell which party is the thief, so it assumes theft and revokes the whole family: R3 stops working too, and both parties must sign in again. The real user can do that with their password; the attacker cannot.

Step throughReuse detection revokes the family
ClientAttackerAuth server
Refresh with stolen R2
Access token + R3
Refresh with R2 (already used)
R2 reused: assume theft
Revoke family R1..R3
400 invalid_grant
Refresh with R3
400 invalid_grant

8 messages in order. Play them, or step through them one at a time.

Neither party can continue; only the real user can sign in again.

The same logic works in the other order. If the real client refreshes first, the attacker's later use of the old token triggers the revocation. Either way, a stolen refresh token stops working as soon as both parties try to use it.

6Why Public Clients Need Extra Care

A confidential client, such as a server-side web application, authenticates to the authorization server with its own secret, so a stolen refresh token alone is not enough to use it. A public client, such as a mobile app or a single-page app in the browser, cannot keep a secret, so the refresh token is the whole credential.

For these clients, rotation with reuse detection should be on, and the token should be stored as safely as the platform allows: the iOS Keychain or Android Keystore on mobile, and ideally not in the browser at all, by using a backend-for-frontend that keeps tokens on the server. Sender-constrained tokens go further: with DPoP (a proof that the client holds a private key), the refresh token is bound to a key on the device, so a copied token does not work elsewhere.

7Follow-up questions

Why not just make access tokens last a day and skip refresh tokens?

Because a day-long JWT that cannot be revoked is a day-long risk after it leaks, and also after the user is disabled or loses a permission. Short access tokens plus refresh tokens give us both: cheap local validation and a regular checkpoint where the server can say no.

Does rotation cause problems for clients?

It can, when a client sends several refresh requests in parallel with the same token. The first succeeds and the others look like reuse, which can revoke the session. Clients should serialise refreshes, and some servers allow a short grace period for this case.

Is an opaque refresh token better than a JWT refresh token?

Usually yes. The refresh token is only read by the authorization server, which looks it up in its own store anyway, so there is no benefit in making it self-contained. An opaque random string reveals nothing if it is seen and is easy to revoke.

8Conclusion

In this answer, we saw why access tokens are short: an API validates a JWT locally and cannot revoke it, so the lifetime limits the damage of a theft. Refresh tokens live longer because they go only to the authorization server, which checks them on every use. Rotation makes each refresh token single-use, reuse detection revokes the whole family when an old token appears again, and public clients need rotation, safe storage and ideally sender-binding.

What to say in the interviewAbout 90 seconds aloud

Open with

Access tokens are short-lived because APIs validate them locally, just by checking the signature and expiry. That is fast, but it means a stolen access token cannot easily be revoked; it works until it expires.

Then, if they want more

So the lifetime is the damage window, and we keep it at around five to fifteen minutes. Refresh tokens can live longer because they are only ever sent to the authorization server, never to APIs, and that server checks them against its own state every time.

It can refuse a refresh token if the user was disabled or the session was revoked, so each refresh is a checkpoint. Rotation means that every time the client uses a refresh token, it gets a new one back and the old one is invalidated, so each refresh token is single-use. Reuse detection builds on that.

If an old refresh token shows up a second time, the server cannot know whether the real client or a thief is using it, so it assumes theft and revokes the whole family of tokens from that sign-in. The real user signs in again with their password, and the attacker is locked out.

For public clients like mobile apps and SPAs, which cannot hold a client secret, I would always turn on rotation and reuse detection, store the token in the platform's secure storage, and consider binding it to the device with DPoP.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
RFC 7519, JSON Web Token
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Why are access tokens usually short-lived while refresh tokens live longer? What is...": https://scrivio-interview-library.netlify.app/spring-boot/jwt/e824c40e6d/