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

Breaking Bug since Allauth v0.63.1 when registering using Google "User is already registered with this e-mail address" #641

Open
adrenaline681 opened this issue Jun 7, 2024 · 4 comments

Comments

@adrenaline681
Copy link
Contributor

After updating the packages of our application to the latest version we found a bug when a user registers using Google. The API endpoint errors out with this message:

User is already registered with this e-mail address

I can confirm that there is no user registered with this email address before I send the request. The odd thing is that this user does get created properly in the database. So it's almost like it's creating the user once, and then trying again and failing.

Here is how my view looks like.

class GoogleLoginView(SocialLoginView):
    adapter_class = GoogleOAuth2Adapter
    client_class = OAuth2Client

I can confirm that this issue is not happening with Allauth v0.63.0 but does happen with v0.63.1

Not sure if this issue might be related but in there it was mentioned that the issue could be in dj-rest-auth

@famoseagle
Copy link

I originally posted this issue on allauth. See @pennersr's comment. The breaking change relates to this commit which affects this conditional in dj-rest-auth.

Do you need that block if allauth already checks for existing users?

@adrenaline681 adrenaline681 changed the title Bug since Allauth v0.63.1 when registering using Google "User is already registered with this e-mail address" Breaking Bug since Allauth v0.63.1 when registering using Google "User is already registered with this e-mail address" Jun 7, 2024
@ShotSkydiver
Copy link

How are you upgrading allauth past 0.61.1? When I try to bump it past that version, there's a conflict because dj-rest-auth requires 0.61.1 or below

@Meess
Copy link

Meess commented Aug 22, 2024

I've also added my explanation here: #650

Allauth already saves the user, and after that in SocialLoginSerializer.Validate (from dj-rest-auth) it tries to check if the e-mail adress is already used ( but it always is as allauth just created the user. Hence always throwing this error on signup (however second time login does log the user in). For more details check my issue

@Meess
Copy link

Meess commented Aug 22, 2024

I originally posted this issue on allauth. See @pennersr's comment. The breaking change relates to this commit which affects this conditional in dj-rest-auth.

Do you need that block if allauth already checks for existing users?

dj-rest-auth might indeed not need the validation. But from my perspective "is_existing" is buggy here, as it works with a version of the user which doesn't reflect the changes allauth actually made to it.

If dj-rest-auth would rely on allauth, and not do the check, then you also get weird behaviour with the "assumed functionality of dj-rest-auth" i.e. post_signup being called after signup, or it needs to do another check (which is difficult if you can't trust the user object to be up-to-date with the changes allauth made.

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

No branches or pull requests

4 participants