Skip to content

Conversation

BlackIsBlack
Copy link
Contributor

Fixes #432

Changes:

  • Added unique constraint on the fief_oauth_accounts table between oauth_provider_id -> account_id
  • Updated get_one_or_more to use scalar_one_or_none.
  • Update OAuth2 callback logic to follow the following rules
    • If there is an OAuthAccount, update the tokens in any case
    • If there is a user linked, proceed with the login logic
    • If there is no user linked, proceed with the registration logic
    • If there is no OAuthAccount create it and proceed with the registration logic

@frankie567
Copy link
Member

Thank you @BlackIsBlack, that's most of it! I'll take it over because a DB migration is needed to add the constraint + I would like to add a unit test for the dangling account case.

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.60%. Comparing base (ed0fe87) to head (0e087e1).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #433   +/-   ##
=======================================
  Coverage   91.59%   91.60%           
=======================================
  Files         239      239           
  Lines        8093     8099    +6     
=======================================
+ Hits         7413     7419    +6     
  Misses        680      680           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BlackIsBlack
Copy link
Contributor Author

Awesome thanks!

@frankie567 frankie567 merged commit d36c82f into fief-dev:main Aug 29, 2024
13 checks passed
@frankie567
Copy link
Member

@all-contributors add @BlackIsBlack for bug, code

Copy link
Contributor

@frankie567

I've put up a pull request to add @BlackIsBlack! 🎉

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

Successfully merging this pull request may close these issues.

Unable to reauthenticate with Google OAuth
2 participants