I have a curl script GoogleAuthenticationCurl.sh which i have been using for around ten years to request information from Googles different Google APIs.
This script users installed application credentials to build the consent screen for Googles oauth server. I copy the link and it shows the consent screen.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code
Google recently made a change which deprecated the redirect uri of urn:ietf:wg:oauth:2.0:oob
. (#instructions-oob)
If I use the link i used to use i get the following
Google wants us to use redirect_uri=http://127.0.0.1:port or http://[::1]:port">http://[::1]:port
instead of urn:ietf:wg:oauth:2.0:oob
.
So I changed my link to the following and placed it in a web browser
https://accounts.google.com/o/oauth2/auth?client_id=[ClientId]&redirect_uri=http://127.0.0.1b&scope=profile&response_type=code
All went well in the beginning I was able to see the consent screen again and consent to authorization. But instead of getting a authorization code returned I got
This being due to the fact that I am not running a webpage I am just trying to authorize a curl script.
Is there anyway to get my curl script to respond to this request or have google completely removed the ability to authorize a curl Script now?
127.0.0.1
, I personally usehttps://localhost
and have not tested with loopback URL. Check the browser URL when you get to that page and you will findcode=xxxxxxx..
. As for how you can grab the code programmatically there are plenty of options but most of the them involve somewhat of a webserver to spill that back on the page.