All problems

Concurrent Refresh Requests Reuse the Same Token Twice

Level 3 · node · Concurrency · Non-atomic refresh token consumption

Scenario

An authentication service invalidates a refresh token after one use and issues a new token pair. When a mobile client sends two nearly simultaneous requests with the same refresh token, both can succeed and receive different new access tokens. The service reads the token from the repository, creates a new pair through the provider, and only then marks the old token as consumed.

Requirements

- The same refresh token must be consumed successfully by exactly one request - Of two concurrent requests using the same token, only one may receive a new token pair - An already consumed token must return invalid_refresh - Different refresh tokens must be refreshable independently - A successful refresh must leave the old token consumed

Acceptance criteria

  • A single refresh returns a new token pair and consumes the old token
  • Reusing an already consumed refresh token is rejected
  • Exactly one of two concurrent requests for the same refresh token succeeds
  • After concurrent requests, the old refresh token remains consumed
  • Different refresh tokens can each be refreshed successfully