NOTES & IDEAS
Refresh Returns 200, but the User Still Gets Logged Out
A successful refresh response proves only one step worked. Trace which token the next protected request actually uses, then inspect rotation and refresh races.
The scenario looks confusing: an access token lasts 15 minutes, a refresh token lasts seven days, and the refresh endpoint returns 200. Yet the user is logged out at about 30 minutes.
My reply was to check whether the frontend saves and uses the newly generated access token. That is a reasonable first hypothesis. The important next step is to prove or disprove it.
This article discusses a hypothetical debugging exercise. It is not a report of a production incident I resolved.
Follow the credential into the next request
A successful refresh response tells us something about the refresh call. It does not establish which credential the application attaches to a later protected request.
The OAuth 2.0 framework distinguishes obtaining a new access token from presenting an access token to a resource server.
For a hypothetical client that manages bearer access tokens, I would trace this sequence:
Protected request rejected
-> Refresh request sent
-> Refresh response accepted
-> Current access-token state replaced
-> Protected request rebuilt
-> New request sent with current credentials
At each arrow, there is a question the response status alone cannot answer.
For example, a request interceptor might close over an old value. A retry might reuse a previously constructed request. The application's state might change while its API client's default header does not. These are debugging hypotheses, not established causes.
Treat the timing as a clue
A repeated 30-minute logout might suggest that one renewal works and the next does not. It could also reflect a separate session policy or frontend timer.
I would build a small timeline containing request IDs, expiry metadata when available, refresh outcomes, and the point where the client transitions to “signed out.” I would exclude raw access tokens and refresh tokens from that record.
The goal is to locate the first disagreement between the expected credential state and the actual request behavior.
Check refresh-token replacement too
A server can issue a replacement refresh token. OAuth requires a client receiving a new one to replace the old value. See RFC 6749, section 6.
If the access token is replaced but the refresh token is not, a later renewal may use stale credentials.
Current OAuth security guidance describes refresh-token rotation and sender-constrained tokens. For public clients, one of those protections is required by RFC 9700. Rotation also makes overlapping refresh attempts worth investigating: the order of requests and stored responses can matter.
Avoid solving the wrong architecture
Not every browser application stores a bearer token in JavaScript. A server-managed session or backend-for-frontend may use an HTTP-only cookie instead.
For that architecture, I would inspect whether the expected cookie is sent and accepted, and whether its scope and lifetime match the application's design. “Save the token in localStorage” is not a universal fix.
For a token-managing client, a shared in-flight refresh operation can be a useful design to evaluate. It lets waiting requests observe one refresh result instead of independently starting renewals. Retrying must still be bounded, and replaying a write requires attention to its business effect.
Prove the hypothesis
A useful investigation ends with evidence: which credential was used, why it was rejected, and why the client logged out.
The original reply identifies a good place to look. A complete explanation keeps that hypothesis separate from a confirmed root cause.