Demo: Token Refresh Race

How the race condition works
  1. Both contexts (main page + iframe) start with the same refresh token
  2. Click "Expire JWT" — both detect expiry and try to refresh simultaneously
  3. Server receives two refresh requests with the same token
  4. First request wins: gets new tokens, old token is invalidated
  5. Second request fails: token already used → logged out!
  6. Random network latency (100-500ms) determines the winner

🖥️ Server State (real backend)

Current Refresh Token: Loading...
JWT Status: Loading...

📄 Main Page

Auth Status: Logged In
My Refresh Token:

🖼️ Iframe (same origin)