Join our Newsletter — 33% off our NHI Course
Home› FAQ› Authentication, Authorisation & Trust› What happens when refresh token rotation is not…
Authentication, Authorisation & Trust

What happens when refresh token rotation is not serialized across workers?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated December 3, 2026 Domain: Authentication, Authorisation & Trust

When refresh token rotation is not serialised across workers, two processes can redeem the same refresh token at once, causing one rotation to invalidate the other and creating authentication failures or token replay risk. The usual control is a single writer, locking, or transactionally coordinated token storage so only one worker updates the token lineage at a time.

What breaks when two workers rotate the same refresh token at once?

Refresh token rotation assumes a single, ordered token lineage. If two workers redeem the same refresh token concurrently, each can believe it has the valid successor while the other invalidates the lineage state underneath it. The result is usually a mix of failed sign-ins, unexpected token rejection, and in some cases a replay window that should never exist.

That failure mode is less about the token itself and more about coordination. Rotation only behaves safely when token state is updated once, in one order, by one writer. Without that serialisation, the system can create a race between “issue the next token” and “mark the old token spent.”

Where this shows up most often is in horizontally scaled workers, retry logic, or duplicated background jobs. The application may treat refresh as an idempotent-looking operation, but token rotation is not idempotent if the server uses reuse detection or family invalidation. The OAuth Refresh Token Rotation and Expiry Guide is useful when you need to understand how rotation, reuse detection and expiry are supposed to behave in practice.

Why token lineage has to be updated atomically

A refresh token family only works if the server can tell which token was redeemed first and which successor became authoritative. When that ordering is lost, a worker may issue a fresh token while another worker still sees the old one as usable, or it may revoke a token that a peer has already handed to the client. That is why the control is usually a single writer, a lock, or transactional storage around the lineage record.

The practical consequence is that refresh rotation behaves like a consistency problem, not just an authentication problem. You need the token store to enforce “one redemption, one successor” semantics, otherwise the lineage can fork or collapse. The Token Lifetime Policy Design Guide helps when you are setting lifetimes and expiry rules that make these races less damaging.

For OAuth-specific behaviour, the protocol-level guidance matters too. RFC 9700 is the current best-current-practice reference for reducing token theft and replay risk, and RFC 6749 remains the base framework for how refresh token flows are structured. Together they support the operational rule that refresh handling must be coordinated, not improvised per worker.

How to recognise a rotation race versus real token theft

Not every invalid refresh token event means compromise. A rotation race often presents as a burst of authentication failures tightly clustered around a deploy, retry storm, or multi-region failover, with the client suddenly receiving invalid_grant or equivalent errors after one worker has already advanced the lineage. True replay or theft usually shows a cleaner pattern of reuse from an unexpected context, but both can look similar if the platform logs are thin.

The key distinction is whether the system itself created competing refresh outcomes. If the same token was redeemed twice inside your own infrastructure, the first response should be to inspect coordination and storage semantics before assuming malicious activity. If there is evidence of reuse outside normal worker behaviour, then the same event can become an indicator of token replay rather than a pure race condition.

The How to detect use of a stolen OAuth refresh token guide is helpful when you need to separate reuse signals from benign concurrency, and the OAuth invalid_grant Error Troubleshooting Guide is the better starting point when the symptom is an error spike and you need to distinguish expiry, revocation and rotation races.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-07 — Long-Lived SecretsRefresh token lineage problems often worsen when secrets live too long.
Recommendation — Shorten refresh token lifetime and rotation windows to reduce replay exposure.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementRefresh tokens are authenticators whose lifecycle and reuse must be controlled.
Recommendation — Enforce coordinated lifecycle handling for refresh tokens and revoke on suspected reuse.

Practitioner Guidance

What to verify: Confirm whether the token store enforces a single authoritative update path for a refresh token family. If multiple workers can redeem or persist the same lineage without a lock or transaction boundary, the design is already vulnerable to race-driven invalidation.

Decision rule: If the symptom appears only under concurrency, treat it as a coordination defect first, not a user-session defect. If the same token family is seen from multiple execution paths, serialise redemption before you tune lifetimes or widen retry windows.

Common mistake: Retrying refresh on failure without preserving lineage ordering can amplify the problem. The retry may succeed locally while silently invalidating the client’s next use, which makes the failure intermittent and harder to diagnose.

Practitioner takeaway: Refresh token rotation is only safe when the storage layer can make one worker the sole writer for a given lineage at a time; without that guarantee, “normal” concurrency can look indistinguishable from replay and break authentication stability.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on December 3, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org