【问题标题】:Django Socail-Auth and My AuthDjango Socail-Auth 和我的 Auth
【发布时间】:2011-07-10 17:52:03
【问题描述】:
【问题讨论】:
标签:
python
django
django-socialauth
socialauth
【解决方案1】:
django-social-auth 提供通过特定后端(例如 Google、Facebook 或 Twitter)进行身份验证的视图。看一下social_auth的URLconf中定义的代码:https://github.com/omab/django-social-auth/blob/master/social_auth/urls.py
安装 social_auth 后,如果您想使用 Twitter 登录,您可以访问指定适当后端的 begin url(例如 /login/twitter/)。 social_auth 应用程序会将您的用户重定向到 Twitter,此时他们会授权您的应用程序,然后您将被重定向回 complete 网址(例如 /complete/twitter)。
如果您想将 Twitter 帐户与现有用户(即通过 admin 应用程序创建的用户,或类似 django-registration 的用户)相关联,您可以访问 associate_begin 网址(例如“/联想/推特/“)。
这一切都假定您的根 URLconf 包含如下条目:
url(r'', include('social_auth.urls')),