hermanho / MMM-GooglePhotos

Display your photos on MagicMirror from Google Photos.
MIT License
170 stars 65 forks source link

Error when generating token using generate_token_v2.js #195

Open rsiggins opened 1 month ago

rsiggins commented 1 month ago

I decided to rebuild my MM from scratch. The previous installation was using MMM-GooglePhotos without problems. I downloaded the credentials.json for an existing project from Google and attempted to run node generate_token_v2.js and got the following errors:

_pi@raspberrypi:~/MagicMirror/modules/MMM-GooglePhotos $ node generate_token_v2.js /home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/@google-cloud/local-auth/build/src/index.js:52 throw new Error(invalidRedirectUri); ^

Error: The provided keyfile does not define a valid redirect URI. There must be at least one redirect URI defined, and this sample assumes it redirects to 'http://localhost:3000/oauth2callback'. Please edit your keyfile, and add a 'redirect_uris' section. For example:

"redirect_uris": [ "http://localhost:3000/oauth2callback" ]

at authenticate (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/@google-cloud/local-auth/build/src/index.js:52:15)
at generate (/home/pi/MagicMirror/modules/MMM-GooglePhotos/generate_token_v2.js:32:24)
at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-GooglePhotos/generate_token_v2.js:46:1)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47

Node.js v20.9.0_

I tried using the credentials.json from the previous installation and get the same errors.

I have been looking for other instances of this problem and have been unsuccessful. Any suggestions on where to look to correct this?

Richard

hermanho commented 1 month ago

Is it a "Desktop app" when creating OAuth client ID?

rsiggins commented 1 month ago

Yes. After I posted this I, discovered Google is changing the API in April 2025 and may break MMM-GooglePhotos. I switched to wallpaper and a NFS fileshare. Much simpler and does not depend on Google.