hermanho / MMM-GooglePhotos

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

generate_token.js error #138

Closed Daemuon closed 1 year ago

Daemuon commented 2 years ago

When I run: node generate_token.js I receive the following:

pi@raspberrypi:~/MagicMirror/modules/MMM-GooglePhotos $ node generate_token.js [GPHOTOS:CORE] TypeError: Cannot read property '0' of undefined /home/pi/MagicMirror/modules/MMM-GooglePhotos/GPhotos.js:133 throw e ^

TypeError: Cannot read property '0' of undefined at new Auth (/home/pi/MagicMirror/modules/MMM-GooglePhotos/GPhotos.js:35:91) at GPhotos.onAuthReady (/home/pi/MagicMirror/modules/MMM-GooglePhotos/GPhotos.js:130:14) at GPhotos.generateToken (/home/pi/MagicMirror/modules/MMM-GooglePhotos/GPhotos.js:141:10) at Object. (/home/pi/MagicMirror/modules/MMM-GooglePhotos/generate_token.js:10:9) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

Tried searching but have not found how to fix this. Thanks.

joshcsepegi commented 2 years ago

I am having the same issue. worked on a previous install of mmirror.

relluts commented 2 years ago

Same issue here. Someone please help

pixel-lake commented 2 years ago

Make sure you select "Desktop Client" when you generate OAuth key. That has solved the problem for me. Can not get past the google authentication though, with "local host resfused to connect" message...

phevi0 commented 2 years ago

Desktop client made it work for me as well :)

The localhost refused to connect is normal - you just need the code from the url it redirects you to.

G1ZMO-101 commented 2 years ago

Hi @phevi0 @pixel-lake how do i check for desktop client? I have spent hours trying to get this to work

Many Thanks Ashley.

phevi0 commented 2 years ago

Set it as Application Type on GCP OAuth client:

image

bfr31tas commented 2 years ago

What did the trick for me was:

  1. ADD USER in the OAuth consent screen.
  2. Generate a NEW OAuth Credentials with Application type as "Desktop app".

Hope this helps.

hermanho commented 1 year ago

The token generation is changed in latest version. Please pull the source code and try it. When the problem is still there, please open a new issue.