Skip to content

"State doesn't match" race condition #67

Closed
@aaronadamsCA

Description

@aaronadamsCA

We started running into occasional Auth0 failures with "State doesn't match". After a day of banging my head against the wall, I think I have a pretty good idea of what's going on:

https://stackoverflow.com/questions/65493296/authorization-code-flow-concurrent-requests-from-multiple-tabs

If a user simultaneously loads multiple pages while unauthenticated, the result is a race condition:

  1. Tab 1 updates state and redirects to OAuth
  2. Tab 2 updates state and redirects to OAuth
    • Overwriting Tab 1 state
  3. Tab 1 callback fails due to state mismatch
  4. Tab 2 callback succeeds

This is pretty common when reopening a closed browser, for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions