Googlesheets Quickstart example unreachable in localhost
Expected Behavior
From the example provided in - https://developers.google.com/sheets/api/quickstart/go#run_the_sample , the expected behaviour upon running the app first time is:
In your browser, go to http://localhost:8000.
The first time you run the sample, it prompts you to authorize access:
If you're not already signed in to your Google Account, you're prompted to sign in. If you're signed in to multiple accounts, select one account to use for authorization.
Click Accept.
Copy the code from the browser, paste it into the command-line prompt, and press Enter.
Authorization information is stored in the file system, so the next time you run the sample code, you aren't prompted for authorization.
Actual Behavior
nothing running in localhost
curl http://localhost:8000 7 ↵ ryemane@robel-cs
curl: (7) Failed to connect to localhost port 8000 after 4 ms: Connection refused
and when following the link that the app suggest to visit i.e.
go run quickstart2.go 1 ↵ ryemane@robel-cs
Go to the following link in your browser then type the authorization code:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=372148273502-3kj1acfo674on8q2hodqdbbnv67vvn2r.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fspreadsheets.readonly&state=state-token
I get asked that the app wants to access my google account but when I allow it, it fails to continue and site is unrechable

Steps to Reproduce the Problem
- Strictly followed the example here: https://developers.google.com/sheets/api/quickstart/go
Specifications
- Go version (
go version): go version go1.19.5 darwin/arm64 - OS (Mac/Linux/Windows) Mac
I have the same problem
This workaround did work for me. But, clearly, it's a bug that I'd appreciate a lot if it were fixed. Thanks again.
It seems like there is some code missing from the example. The instructions want you to connect to a local web server but the example code doesn't start one.
This workaround did work for me. But, clearly, it's a bug that I'd appreciate a lot if it were fixed. Thanks again.
This worked. Thanks for pointing it out.