I've been trying to find how to add a new social account to a user that has already signed up and loged in, using django-allauth
. So far, I have found this question, and this other question related to what I need, but what is suggested doesn't work.
I'm using a custom User class, which authenticates through email, and once I have the first social account successfully created, it wont let me add another one. I've tried putting the provider_login_url
in a page where the user is authenticated, as suggested in one of the mentioned answers, but it seems to do logout and then try to sign up again, but then, as the email is the same, "it clashes with the email of an existing user".
How can I get the expected behavior? which is, that django-allauth
recognize the email as belonging to an existing user, and therefore creating only a new socialaccount
, and not a new user.
Adding/connection additional accounts is documented here:
http://django-allauth.readthedocs.org/en/latest/templates.html#social-account-tags
Specifically, see the process
parameter. Example:
<a href="{% provider_login_url "twitter" process="connect" %}">Connect a Twitter account</a>
来源:https://stackoverflow.com/questions/18504883/django-allauth-multiple-social-accounts-with-a-custom-user