我正在使用python 2.7.6,Django 1.8和python-social-auth。在尝试通过googleoauth2进行身份验证时,我收到此错误。回溯附加。我试过这些 -
sudo apt-get install ca-certificates
sudo apt-get install ntpdate
但即便如此,它还是不起作用。
Traceback:
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/apps/django_app/utils.py" in wrapper
51. return func(request, backend, *args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/apps/django_app/views.py" in complete
28. redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/actions.py" in do_complete
43. user = backend.complete(user=user, *args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/backends/base.py" in complete
41. return self.auth_complete(*args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/utils.py" in wrapper
229. return func(*args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/backends/oauth.py" in auth_complete
383. method=self.ACCESS_TOKEN_METHOD
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/backends/oauth.py" in request_access_token
361. return self.get_json(*args, **kwargs)
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/backends/base.py" in get_json
229. return self.request(url, *args, **kwargs).json()
File "/home/ashish/.virtualenvs/ch_web_app/local/lib/python2.7/site-packages/social/backends/base.py" in request
224. raise AuthFailed(self, str(err))
Exception Type: AuthFailed at /complete/google-oauth2/
Exception Value: Authentication failed: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
答案 0 :(得分:4)
pip2.7 install --upgrade httplib2
以上解决方案对我有用
答案 1 :(得分:1)
我遇到了同样的问题。尝试执行pip install urllib3[secure]
,urllib3默认没有证书,所以你必须这样做。这也显示在这里 - > https://urllib3.readthedocs.org/en/latest/security.html#security
答案 2 :(得分:1)
您可以安装以下软件包
python -m pip install pyopenssl pyasn1 ndg-httpsclient
我通过安装上面的库解决了同样的问题。