gphotos-uploader-cli icon indicating copy to clipboard operation
gphotos-uploader-cli copied to clipboard

"[fatal] unable to get token" Error (Bug? User Error?)

Open blakenan-bellese opened this issue 2 years ago • 4 comments

Describe the bug After setting up the GCP project and configuring OAuth, I'm getting an "[fatal] unable to get token" error after I enter the authorization code.

To Reproduce Steps to reproduce the behavior:

  1. Install via homebrew
  2. Run gphotos-uploader-cli init
  3. Follow APIAppCrendentials steps
  4. Edit config.hjson (I used SecretsBackend = auto)
  5. Run gphotos-uploader-cli push
  6. Visit the URL provided, complete steps and copy/paste the resulting authorization code
  7. Get error "[fatal] unable to get token: Post "https://oauth2.googleapis.com/token": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"

Expected behavior I expected the jpg files in the specified directory to be uploaded to an album named after the folder, per CreateAlbums setting.

Screenshots none

Desktop & Client versions (please complete the following information):

  • Operating System: Mac OS Monterey (12.3)
  • Version v3.3.0

Additional context I've reviewed my actions against the documentation several times. I'm fairly confident that this is not caused by user error, but this is the first time using this tool and I'm not an OAuth expert. Apologies in advance if this is user error.

blakenan-bellese avatar Mar 30 '22 13:03 blakenan-bellese

Hi @blakenan-bellese

Unfortunately I don't have a Mac system to test it, **would you mind to run gphotos-uploader-cli --debug push?

pacoorozco avatar Mar 30 '22 17:03 pacoorozco

@pacoorozco Thanks for the reply. I ran the command with the debug flag, see below for my terminal contents. Note: I replaced some potentially sensitive info with a bunch of Xs.

bill@bills-mbp ~ % gphotos-uploader-cli push --debug [04/1/22| 9:15AM] [info] Reading configuration from '/Users/bill/.gphotos-uploader-cli/config.hjson' [debug] Current configuration: {"APIAppCredentials":{"ClientID":"XXXXXXXXX.apps.googleusercontent.com","ClientSecret":"REMOVED"},"Account":"[email protected]","SecretsBackendType":"auto","Jobs":[{"SourceFolder":"/Users/bill/Pictures/auto-upload","CreateAlbums":"folderName","DeleteAfterUpload":false,"IncludePatterns":[],"ExcludePatterns":[]}]} [info] Getting OAuth token for '[email protected]' [debug] Unable to retrieve token from token manager: token was not found [debug] Getting OAuth2 token from prompt...

Visit the following URL in your browser: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXXXXXXXXXX.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fphotoslibrary&state=state

After completing the authorization flow, enter the authorization code here: XXXXXXXXXXXXXXXXXXX [fatal] unable to get token: Post "https://oauth2.googleapis.com/token": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

blakenan-bellese avatar Apr 01 '22 13:04 blakenan-bellese

It's very strange but it's not the first time that I've seen this kind of failures in Mac.

It seem that your terminal cannot reach the Google endpoint 😪 are you using a VPN or outbound firewall?

How have you installed the CLI? Homebrew or tar file?

pacoorozco avatar Apr 06 '22 07:04 pacoorozco

@pacoorozco I'm not using a VPN or outbound firewall. I used homebrew to install. When I get a few minutes I'll try to connect manually to that Google endpoint using Postman. Maybe I can determine the cause. Appreciate the feedback/

blakenan-bellese avatar Apr 06 '22 12:04 blakenan-bellese

Any update @blakenan-bellese , otherwise I will close the issue assuming that it worked at the end 😅

pacoorozco avatar Jan 25 '23 09:01 pacoorozco

@pacoorozco I haven't looked at this in a while. I'll try to reproduce the error in the next week. If you don't hear from me, feel free to close the issue. Thanks for the follow-up.

blakenan-bellese avatar Jan 25 '23 13:01 blakenan-bellese