RealmTeam / django-rest-framework-social-oauth2

python-social-auth and oauth2 support for django-rest-framework
MIT License
1.06k stars 191 forks source link

already registered emails bug fixed #214

Open hrahmadi71 opened 4 years ago

hrahmadi71 commented 4 years ago

In such case that user email is unique and normal user registering is available: If a user tries to social sign-in with a registered email, it will end up with db error saying the email is already exists! For example assume this scenario: 1- user register normally (using normal register form) with his/her gmail. 2- the user tries to login by google with the same gmail address. as I mentioned above, convert-token request will response with 500 error because of db error. I fixed this problem by catching this error in oauth2_grants file (SocialTokenGrant.validate_token_request method).

fabiovasini commented 3 years ago

Hi! Can you please push this change to pip? I'm facing the same problem. Thanks