Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthorizationFailureError with SSL: CERTIFICATE_VERIFY_FAILED #198

Closed
Masterxilo opened this issue Jun 24, 2018 · 7 comments
Closed

AuthorizationFailureError with SSL: CERTIFICATE_VERIFY_FAILED #198

Masterxilo opened this issue Jun 24, 2018 · 7 comments

Comments

@Masterxilo
Copy link

I ran gdfstool auth --url, visited the URL, got the auth code, then I did this:

$ gdfstool auth --auth ~/gdfs.credentials2 4/AAC_Cy8Q-wboFTYzpV---REST-OMITTED---      
Traceback (most recent call last):
  File "/usr/local/bin/gdfstool", line 125, in <module>
    main()
  File "/usr/local/bin/gdfstool", line 118, in main
    _handle_auth(args)
  File "/usr/local/bin/gdfstool", line 56, in _handle_auth
    _handle_auth_store(*args.auth)
  File "/usr/local/bin/gdfstool", line 50, in _handle_auth_store
    authorize.step2_doexchange(authcode)
  File "/usr/local/lib/python2.7/dist-packages/gdrivefs/gdtool/oauth_authorize.py", line 143, in step2_doexchange
    raise AuthorizationFailureError(message)
gdrivefs.errors.AuthorizationFailureError: Could not do auth-exchange (this was either a legitimate error, or the auth-exchange was attempted when not necessary): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

What am I doing wrong?

@asreimer
Copy link

asreimer commented Aug 8, 2018

I have also encountered this error.

@asreimer
Copy link

asreimer commented Aug 9, 2018

Hey @Masterxilo,

I figured out the issue. Maybe you already have too.

TL;DR: Update your google-api-python-client package to use the latest version

Google moved their code to github have changed some things (as per #149). You need to use their updated google-api-python-client available here: https://github.com/google/google-api-python-client It appears that the older version which was hosted in code.google.com is no longer compatible with whatever changes google made to their API.

To get things working again, all I did, roughly speaking, was:

mkdir mount_gdrive
cd mount_gdrive
pip install -U oauth2client
pip install -U google-api-python-client
git clone https://github.com/dsoprea/GDriveFS
cd GDriveFS
pip install .
cd ..
mkdir -p mnt/googledrive
gdfstool auth_get_url
gdfstool auth_write "<INSERT KEY FROM GOOGLE>"
gdfs default mnt/googledrive/

If you just pip install GDriveFS, you will get a different version than what is currently in master. This version doens't have the new gdfstool syntax that I'm using here.

You'll should also see that you need to pip install oauth2client.

@d3stusi
Copy link

d3stusi commented Jan 7, 2019

@asreimer I followed your instructions but when running auth_get_url i'm getting an error saying gdfstool command is not found. Tried executing from a few different directories down to the resources/scripts one from GdriveFS but still no luck. Same message for gdfs default mnt/googledrive/

@pantegra
Copy link

I have followed you instructions on getting the gdfstools installed. This is what I get now.
pi@raspberrypi:~ $ gdfstool auth_get_url
Traceback (most recent call last):
File "/usr/local/bin/gdfstool", line 15, in
import gdrivefs.gdfs.gdfuse
ImportError: No module named gdfs.gdfuse
For some reason the import is not picking up all the items in the module. From the python command line I imported the gdrivefs module and ran a dir() on the object to find out what attributes are on that module This is what is reported back.

import gdrivefs.gdfs
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named gdfs
dir(gdrivefs)
['builtins', 'doc', 'file', 'name', 'package', 'path', 'version']

There is diffidently some link missing somewhere in the new scripts.
python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.

@pantegra
Copy link

Well i got the system to work, kinda. This is what I am getting now.
pi@raspberrypi:~ $ sudo gdfstool auth -a /home/pi/gdfs.creds "{MY code}"
Traceback (most recent call last):
File "/usr/local/bin/gdfstool", line 125, in
main()
File "/usr/local/bin/gdfstool", line 118, in main
_handle_auth(args)
File "/usr/local/bin/gdfstool", line 56, in _handle_auth
_handle_auth_store(*args.auth)
File "/usr/local/bin/gdfstool", line 50, in _handle_auth_store
authorize.step2_doexchange(authcode)
File "/usr/local/lib/python2.7/dist-packages/gdrivefs/gdtool/oauth_authorize.py", line 143, in step2_doexchange
raise AuthorizationFailureError(message)
gdrivefs.errors.AuthorizationFailureError: Could not do auth-exchange (this was either a legitimate error, or the auth-exchange was attempted when not necessary): invalid_grantBad Request

Any thoughts

@dsoprea
Copy link
Owner

dsoprea commented Jan 28, 2019

Looks like you have a local issue with your installed libraries. I also just adjusted some dependency versions the other day. You might want to try it again, but it might be better, at least for experimentation, to use virtualenv, which is a sandbox that gives you the ability to ignore anything else that might already be installed on your system.

Try testing with this if/when you have virtualenv installed:

$ git clone git@github.com:dsoprea/GDriveFS.git gdrivefs.test
...

$ cd gdrivefs.test/
$ virtualenv -ppython3.6 .
...

$ source bin/activate
(gdrivefs.test) $ pip install .
...

(gdrivefs.test) $ gdfstool auth_get_url
To authorize FUSE to use your Google Drive account, visit the following URL to produce an authorization code:

https://accounts.google.com/o/oauth2/auth?client_id=1056816309698.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file&access_type=offline&response_type=code

(gdrivefs.test) $ gdfstool auth_write 4/4ABu4tyBNg9..........................q1RlSKq7sbmvINMtYM
Authorization code recorded.

(gdrivefs.test) $ gdfs default /tmp/gd

The example above uses Python 3.6 but any Python should work.

@dsoprea
Copy link
Owner

dsoprea commented Jan 28, 2019

I'm gonna close this issue for now since the project is fine.

@dsoprea dsoprea closed this as completed Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants