Im trying to read emails using the GMail API, on a VM with python installed in Google Cloud Platform.
When I run the example code (https://developers.google.com/gmail/api/quickstart/python), with my credentials.json file in the same server, I get an error like this one:
Please visit this URL to authorize this application: lynx https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=633324569-jo12blf7cp6d32g876ag86gi3f0.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A35059%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly&state=OejPrI9PZz2uvlE1Nt2PsE3hbTbNIV&access_type=offline
When I use the script in local I just access, authorize it and it runs, but when I use it in Cloud I go to this website, authorize it but never return to the original place since the "redirect_uri" is localhost.
I even tried to open "navigation services" like browsh or elinkx in the ssh to authorize my account, but never worked...
Any idea? TIA