PyDrive guath.Refresh() and Refresh Token Issues

Deadly 提交于 2019-12-05 12:59:46

I have been there and below works for me.

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive   
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
gauth.LoadCredentialsFile(gauth)

Create a new folder with above code as quickstart.py in root dir.
Download client_sercrets.json from google drive api credentials and put it in root
Put your settings.yaml file in root folder
Run the quickstart.py from your console and it will open a browser ask you to authorise app.
Once this process is completed, it will create a credentials.json file in your root directory.
Access token should be able to refresh itself now.

Few things to note for your Drive API settings, it should be Web application type, in Authorize Javascript "http://localhost:8080" and in Authorized redirect URIs "http://localhost:8080/"

If this is successful, carry over "credentials.json", "client_secrets.json", "settings.yaml" files to your production root dir and it should work.

Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!