Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix race condition on code exchange for token #411

Conversation

jpaniagualaconich
Copy link
Contributor

During token exchange where an authorization code is exchanged for an access token and a refresh token, the same code can be used more than once. This happens if more requests are issued in parallel.

This PR adds a .select_for_update so only the first attempt goes through.

Fixes #410.

@jpaniagualaconich jpaniagualaconich force-pushed the bugfix/fix-code-exchange-race-condition branch from 8dd0489 to b1977bf Compare September 12, 2023 15:12
@juanifioren juanifioren changed the base branch from master to develop September 23, 2023 16:22
@juanifioren juanifioren force-pushed the bugfix/fix-code-exchange-race-condition branch from b1977bf to 7d186ee Compare September 23, 2023 16:22
@juanifioren juanifioren self-requested a review September 23, 2023 16:23
@juanifioren juanifioren self-assigned this Sep 23, 2023
Copy link
Owner

@juanifioren juanifioren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff!! thanks @jpaniagualaconich

@juanifioren juanifioren merged commit e67826c into juanifioren:develop Sep 23, 2023
1 check passed
@jpaniagualaconich
Copy link
Contributor Author

@juanifioren thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

parallel requests may reuse same authorization code
2 participants