Django allauth - Multiple social accounts with a custom user

情到浓时终转凉″ 提交于 2019-11-29 23:04:17

问题


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.


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!