![](/img/trans.png)
[英]python social auth and Django - is there a 1:1 relationship between OAuth users and Django users?
[英]Python Social Auth Django Github OAuth
我正在嘗試使用Python-Social-Auth庫將Django網站與Github身份驗證集成
到目前為止的配置:
settings.py
INSTALLED_APPS += (
...
"social_django",
"social_core",
)
AUTHENTICATION_BACKENDS = [
"account.auth_backends.UsernameAuthenticationBackend",
"social_core.backends.github.GithubOAuth2",
]
TEMPLATES = [
{
...
'context_processors': [
...
"social_django.context_processors.backends",
"social_django.context_processors.login_redirect",
],
},
},
]
的login.html
<a href="{% url "social:begin" "GithubOAuth2" %}">Github</a>
urls.py
url("^socialaccounts/", include('social_django.urls', namespace='socialaccounts')),
但是,當我單擊鏈接時,它顯示404未找到頁面。 在哪里放置密鑰和其他github配置?
它們進入項目的settings.py
文件中。
INSTALLED_APPS += (
...
"social_django",
"social_core",
)
AUTHENTICATION_BACKENDS = [
"account.auth_backends.UsernameAuthenticationBackend",
"social_core.backends.github.GithubOAuth2",
]
TEMPLATES = [
{
...
'context_processors': [
...
"social_django.context_processors.backends",
"social_django.context_processors.login_redirect",
],
},
},
]
SOCIAL_AUTH_GITHUB_KEY = ''
SOCIAL_AUTH_GITHUB_SECRET = ''
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.