Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Drive SDK Python Quickstart Sample

When I see this tutorial and try to run the test code Google Drive SDK Python Quickstart Sample

Video: https://www.youtube.com/watch?v=zJVCKvXtHtE&list=PL0FA2818902D9D123

Code: https://docs.google.com/document/d/1GD3Ee07QsqxQZ-UDTNIbMqtSu4U_servCeQsd9rCkp8/edit

I got an error, it is saying "ValueError: The value of redirect_uri must not be None"

I googled, can't fix this problem. What should I fix?

Thank you!!!

like image 403
user1460925 Avatar asked Feb 25 '26 02:02

user1460925


1 Answers

The problem is really simple actually.The api just needs to know what to do with the credential.You see a installed application and a web application handles it differently.For a web application, authorising would redirect the user to another page. For a installed application, you might want to be provided with a key.

So if you are using a installed application, change the following lines of code.

from oauth2client.client import flow_from_clientsecrets

path_to_json="client_secrets.json"    # download from https://code.google.com/apis/console/
AUTH_SCOPE 'https://www.googleapis.com/auth/drive'
#redirect_uri also provided in api console.The other URI mentioned there is for web applications.

flow = flow_from_clientsecrets(Path_to_JSON,AUTH_SCOPE,redirect_uri="urn:ietf:wg:oauth:2.0:oob")

`

like image 180
SteveIrwin Avatar answered Feb 27 '26 14:02

SteveIrwin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!