前期配置
我已经在项目的 settings.py 中配置了一下内容
AUTHENTICATION_BACKENDS = (
'social.backends.google.GoogleOAuth2',
'django.contrib.auth.backends.ModelBackend',
'account.authentication.EmailAuthBackend',
)
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '<my_key>'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '<my_secret>'
相应的模板中也已经添加了相关链接
<li class="google"><a href="{% url 'social:begin' backend='google-oauth2' %}">Login with Google</a></li>
urls.py 也添加了对应的内容
url(r'social-auth/', include('social.apps.django_app.urls', namespace='social')),
Google+ API 也启用了
问题
点击Login with Google按钮后,跳转到申请权限后,点击允许按钮之后,报如下错误:
Exception Value:
Authentication failed: HTTPSConnectionPool(host='accounts.google.com', port=443): Max retries exceeded with url: /o/oauth2/token (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000005BE6630>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。',))
想问问有没有 V 友知道怎么解决这个问题吗,还是说我前期的配置中缺少了什么,谢谢