Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Googlesheets Quickstart example unreachable in localhost #84

Open
robel-yemane opened this issue Jan 26, 2023 · 3 comments
Open

Googlesheets Quickstart example unreachable in localhost #84

robel-yemane opened this issue Jan 26, 2023 · 3 comments
Assignees

Comments

@robel-yemane
Copy link

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

image

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
image

Steps to Reproduce the Problem

  1. 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
@Frosin
Copy link

Frosin commented Jan 26, 2023

I have the same problem

@robel-yemane
Copy link
Author

This workaround did work for me. But, clearly, it's a bug that I'd appreciate a lot if it were fixed.
Thanks again.

@biggianteye
Copy link

biggianteye commented Feb 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants