简体   繁体   中英

Authentication failed: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I am using python 2.7.6, Django 1.8 and python-social-auth. While trying to authenticate via googleoauth2 I am getting this error. The traceback is attached. I have tried these -

sudo apt-get install ca-certificates
sudo apt-get install ntpdate

But even then its not working.

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
pip2.7 install --upgrade httplib2 

上面的解决方案对我有用

I faced the same issue. Try doing pip install urllib3[secure] , urllib3 doesn't have certs by default so you have to do this. This is also shown here --> https://urllib3.readthedocs.org/en/latest/security.html#security

you can install the following package

python -m pip install  pyopenssl pyasn1 ndg-httpsclient

I got the same issue resolved by installing the above library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM