[英]Python Social Auth Django Github OAuth
I'm trying to integrate my Django website with Github Authentication using Python-Social-Auth library 我正在尝试使用Python-Social-Auth库将Django网站与Github身份验证集成
Configuration so far: 到目前为止的配置:
settings.py 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 的login.html
<a href="{% url "social:begin" "GithubOAuth2" %}">Github</a>
urls.py urls.py
url("^socialaccounts/", include('social_django.urls', namespace='socialaccounts')),
But when I click the link, it shows a 404 Not Found Page. 但是,当我单击链接时,它显示404未找到页面。 And where do I put the secret key and other github configuration? 在哪里放置密钥和其他github配置?
They go in the project's settings.py
file. 它们进入项目的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.