Configuring gphotos-uploader-cli

Folks: I’d like to use gphotos-uploader-cli to keep my photo library up-to-date on Google Photos. I’ve been trying without success for about 3 hours to configure OAuth. I believe I have configured ~/.gphotos-uploader-cli/config.hjson correctly. However, when it directs me as follows:

1845 rmills@rmillsmm-local:~/gnu/github/gphotos-uploader-cli $ gphotos-uploader-cli auth
[info]   Reading configuration from '/Users/rmills/.gphotos-uploader-cli/config.hjson'
[info]   Getting OAuth token for 'robin@clanmills.com'

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

The browser displays a variety or 400 and 401 messages. Nothing useful. Nothing effective. In this case it’s complaining the app is a “Web application”, however it also complains when it’s “Desktop Application” (and all other settings).

screenshot_46

Can anybody help?

I got this to work with more perseverence. Here are steps as best as I can explain.

  1. I followed the link on the 400 error message above.
  2. Set up a new “Desktop Application” and create a ClientID and ClientSecret.
  3. Edited that into ~/.gphotos-uploader-cli/config.hjson
    Use SecretsBackendType: file (NOT keychain) on macOS
  4. sudo env GPHOTOS_CLI_TOKENSTORE_KEY=479…apps.googleusercontent.com ./gphotos-uploader-cli auth told me the URL of the Authorization Screen
    Having authorised it, the web gave me a passphrase
  5. sudo env GPHOTOS_CLI_TOKENSTORE_KEY=479498571666-an0i9pook0eh74htstgbci6dii8ct7eb.apps.googleusercontent.com ./gphotos-uploader-cli push
    I was prompted for the passphrase

Caution This took about 2 hours of blundering in the dark and several reboots. Your experience may different. My steps could be wrong.

Why reboot macOS? To clear this horror:

502 rmills@rmillsmm-local:~/gnu/github/gphotos-uploader-cli $ env GPHOTOS_CLI_TOKENSTORE_KEY=479.....apps.googleusercontent.com ./gphotos-uploader-cli auth
[info]   Reading configuration from '/Users/rmills/.gphotos-uploader-cli/config.hjson'
[error]  File tracker could not be started, err: resource temporarily unavailable
[fatal]  file tracker could not be started, err: resource temporarily unavailable

But is it working and pushing files? Hard to say. Can’t see any evidence in the ActivityMonitor.app or Console.app (log monitor tool). Nothing has clearly changed in Google Photos. However, I have 80,000 photos in my library (4000/annum for 20 years) and maybe something is analysing what’s to be uploaded.

I’ll probably be back here tomorrow to give you an update. I know nobody else is interested in this, however I’m hoping my report will help somebody one-day.

1 Like

It’s working:

576 rmills@rmillsmm-local:~/gnu/github/gphotos-uploader-cli $ ./gphotos-uploader-cli push
[info]   Reading configuration from '/Users/rmills/.gphotos-uploader-cli/config.hjson'
[info]   Getting OAuth token for 'robin@clanmills.com'

Visit the following URL in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=479498571666-an0i9pook0eh74htstgbci6dii8ct7eb.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: 4/1AY0e-g7ONgOx2QV8eUHBwmeqZcdDOTwgBhQhAqt6m-WoipKr63Bqvj_Awm0
[done] √ Token is valid, expires at 2021-02-20 19:50:20.931544 +0000 GMT m=+3632.821845586
Enter the passphrase to open the token store: 
[info]   Found 74767 items to be uploaded processing location '/Volumes/Backup/Photos'.

It’s updating the logs an db in ~/.gphotos-uploader-cli

I didn’t work. I left it running all night. In the morning, the terminal was full of messages such as:

[fail] X Unable to create album 'AlanSummer': Post "https://photoslibrary.googleapis.com/v1/albums?alt=json": POST https://photoslibrary.googleapis.com/v1/albums?alt=json giving up after 5 attempt(s)
[fail] X Unable to create album 'AlmostChristmas': Post "https://photoslibrary.googleapis.com/v1/albums?alt=json": POST https://photoslibrary.googleapis.com/v1/albums?alt=json giving up after 5 attempt(s)

It had correctly created about 1000 Albums, however it hadn’t put a single photo into any of them.