Successfully created a Client ID for Web application in my Google APIs console.
The downloaded client_secret_<really long ID>.json containing all authentication information for my application renamed to client_secrets.json and placed in my working directory.
Givenquickstart.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 alijanif@puhti.csc.fi 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:
Copy the file that gauth.LocalWebserverAuth() on a local machine to the remote machine and use it there (you can point to a file via GoogleAuth() options).
Assumption:
Successfully created a Client ID for Web application in my Google APIs console.
The downloaded
client_secret_<really long ID>.json
containing all authentication information for my application renamed toclient_secrets.json
and placed in my working directory.Given
quickstart.py
:Authentication using my google account works fine in my local laptop with the text:
The authentication flow has completed.
on web browser andAuthentication 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 alijanif@puhti.csc.fi
in my local laptop.So I do the following, in working directory (containing
client_secrets.json
file) of my remote server after successfulSSH
login: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
:What is the easiest workaround to fix this issue for remote servers?