Assumption:
Successfully created a Client ID for Web application in my Google APIs console.
The downloaded
client_secret_<really long ID>.jsoncontaining all authentication information for my application renamed toclient_secrets.jsonand placed in my working directory.
Given quickstart.py:
from pydrive2.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
Authentication using my google account works fine in my local laptop with the text: The authentication flow has completed. on web browser and Authentication successful. in terminal.
Problem:
I would like to run this authentication in a remote server (SLURM super computer) without a graphical environment, which I access it via SSH command as $ ssh [email protected] in my local laptop.
So I do the following, in working directory (containing client_secrets.json file) of my remote server after successful SSH login:
$ python quickstart.py
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?client_id=<my client id>&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&access_type=online&response_type=code
Clicking on the provided link, fails to authenticate me using my google account, The connection failed on web browser!
in a web browser, I get the following link using that http://localhost:8080/ I provided in Authorised redirect URIs:
http://localhost:8080/?code=4%2F0AfJohXnpLFPEPEBOaYJNRUBB4eOMgtRGuWmLzN39mzH0XjcW8lno52y3PGhYZzbjorfqlA&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive
What is the easiest workaround to fix this issue for remote servers?
