hermanho / MMM-GooglePhotos

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

Google OAuth and Redirect URIs #150

Closed Enster1 closed 1 year ago

Enster1 commented 1 year ago

Hi, I came in this morning to work to find two of my MagicMirror modules not working properly. I followed along with Issue #146, but when I run node generate_token_v2.js, I get the following message:

/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/@google-cloud/local-auth/build/src/index.js:55 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:55:15)
at generate (/home/pi/MagicMirror/modules/MMM-GooglePhotos/generate_token_v2.js:10:24)
at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-GooglePhotos/generate_token_v2.js:25:1)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

I believe the token for this module and my other module expired over the holiday and I am unable to refresh either one. Any help would be greatly appreciated. Thanks.

Justaguy93 commented 1 year ago

Hello I received the same issue. You need to generate the OAuth client ID again, chose Desktop for Application type. then acquire and generate the token as directed.

Enster1 commented 1 year ago

Thanks, I have done that multiple times now but to no avail. I ended up removing the module, pulling it fresh from GitHub and reinstalling. Seems to be working now without issue.