Social login existing if related user exists #3680
-
Hey. The latter assertion fails in my app on login. Can someone tell why social login instance is considered existing if there is a related user in the database? How the existing users are supposed to login then? In the library version I had before Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
This must be an issue reported by another user #3679 |
Beta Was this translation helpful? Give feedback.
-
The code performing the |
Beta Was this translation helpful? Give feedback.
-
@pennersr thank you for the response. in my case this line of code returns a SocialLogin instance with a user already attached I use standard Google and LinkedIn providers, so it doesn't seem like my customizations has anything to do with it |
Beta Was this translation helpful? Give feedback.
-
Having a user instance attached is fine, but its As you can see, a |
Beta Was this translation helpful? Give feedback.
-
@pennersr thanks. our adapter indeed returns a saved user instance in |
Beta Was this translation helpful? Give feedback.
Having a user instance attached is fine, but its
pk
should not be set / pointing to an existing user. The user instance originates from this piece of code:https://github.com/pennersr/django-allauth/blob/main/allauth/socialaccount/providers/base/provider.py#L96
As you can see, a
new_user()
is instantiated there, which is not backed yet by a database record.