This code
gauth.LocalWebserverAuth()
isnt working in the webapp hosted in this website. In the localhost this piece of line opens a google authentication window where you can login in but fails to open in my hosted app.
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
# Try to load saved client credentials
gauth.LoadCredentialsFile("mycreds.txt")
if gauth.credentials is None:
# Authenticate if they're not there
gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
# Refresh them if expired
gauth.Refresh()
else:
# Initialize the saved creds
gauth.Authorize()
# Save the current credentials to a file
gauth.SaveCredentialsFile("mycreds.txt")
drive = GoogleDrive(gauth)
This is the error I am getting
home/eyal360/.virtualenvs/fbvenv/lib/python3.9/site- packages/oauth2client/_helpers.py:255: UserWarning:
Cannot access mycreds.txt: No such file or directory
2022-04-26 03:34:52,114:
warnings.warn(_MISSING_FILE_MESSAGE.format(filename))