hermanho / MMM-GooglePhotos

Display your photos on MagicMirror from Google Photos.
MIT License
162 stars 62 forks source link

Generate Token on Docker #158

Open elgeorgie opened 1 year ago

elgeorgie commented 1 year ago

I'm having issues using node generate_token_v2.js and node generate_token.js using MM running on Docker. When I run node generate_token.js, I get the URL that I can paste on the browser to authorize, but when I paste the code in "Return here with your code." I get:

/opt/magic_mirror/modules/MMM-GooglePhotos/GPhotos.js:104 throw new Error("Error getting tokens:", error); ^

Error: Error getting tokens: at processTokens (/opt/magic_mirror/modules/MMM-GooglePhotos/GPhotos.js:104:15) at processTicksAndRejections (node:internal/process/task_queues:96:5)

and when I run node generate_token_v2.js, it just hangs forever and nothing is return. 

Any ideas?
krouton24 commented 1 year ago

I have the same as well

elgeorgie commented 1 year ago

I have the same as well

Any luck? I've tried reinstalling and nothing. Same issue.

elgeorgie commented 1 year ago

As a workaround, I installed PiOS on virtualbox, installed MagicMirror>Google Photo Module and generated a token then copied over to the Docker container. Thus far, working on Docker with token generated on VM.

bgreen87 commented 1 year ago

I've had luck using Windows, assuming the MMM-GooglePhotos directory is being shared on the network:

  1. Install Node.js
  2. Open File Explorer and navigate to the MMM-GooglePhotos directory
  3. Right-click in the white area where the files are sitting (don't select anything) and select "open in terminal"
  4. Run "node generate_token_v2.js"
  5. Follow the prompts in the web browser window (might have to give it a few seconds)
labaland commented 1 year ago

i get this error on windows and on docker :/

Error: Cannot find module 'mkdirp' Require stack:

Node.js v18.16.0

treyturner commented 1 month ago

I struggled with this for a while before realizing it doesn't matter where the token is generated. I cloned the repo to my local workstation and ran the token generator there, where it opened the browser and I clicked through. Afterwards I put the resulting token.json into my host-mounted config directory.

treyturner commented 1 month ago

i get this error on windows and on docker :/

Error: Cannot find module 'mkdirp' Require stack:

  • C:\Users\Marcus\Desktop\MMM-GooglePhotos\generate_token_v2.js at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Module.require (node:internal/modules/cjs/loader:1141:19) at require (node:internal/modules/cjs/helpers:110:18) at Object. (C:\Users\Marcus\Desktop\MMM-GooglePhotos\generate_token_v2.js:4:20) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\Marcus\Desktop\MMM-GooglePhotos\generate_token_v2.js' ] }

Node.js v18.16.0

You need to install dependencies with npm (npm i) or another package manager (yarn, pnpm, bun, etc).

GioD commented 1 month ago

I struggled with this for a while before realizing it doesn't matter where the token is generated. I cloned the repo to my local workstation and ran the token generator there, where it opened the browser and I clicked through. Afterwards I put the resulting token.json into my host-mounted config directory.

Are you doing this every week? Hoping to figure out an automated way to generate new tokens because "publishing" the app in google (as recommended by install.md) seems wildly unrealistic given the requirements to do that in 2024.

hermanho commented 1 month ago

I struggled with this for a while before realizing it doesn't matter where the token is generated. I cloned the repo to my local workstation and ran the token generator there, where it opened the browser and I clicked through. Afterwards I put the resulting token.json into my host-mounted config directory.

Are you doing this every week? Hoping to figure out an automated way to generate new tokens because "publishing" the app in google (as recommended by install.md) seems wildly unrealistic given the requirements to do that in 2024.

Is there any reason to keep the OAuth app in testing? For my own version, I have published it.

GioD commented 1 month ago

I struggled with this for a while before realizing it doesn't matter where the token is generated. I cloned the repo to my local workstation and ran the token generator there, where it opened the browser and I clicked through. Afterwards I put the resulting token.json into my host-mounted config directory.

Are you doing this every week? Hoping to figure out an automated way to generate new tokens because "publishing" the app in google (as recommended by install.md) seems wildly unrealistic given the requirements to do that in 2024.

Is there any reason to keep the OAuth app in testing? For my own version, I have published it.

In order to publish it, google says I need to complete all these steps for verification:

You've configured your app in a way that requires verification . To complete verification, you will need to provide:

An official link to your app's Privacy Policy A YouTube video showing how you plan to use the Google user data you get from scopes A written explanation telling Google why you need access to sensitive and/or restricted user data All your domains verified in Google Search Console

Not sure if the issue is with how I configured the application when creating it, but none of these requirements seem reasonable to me given the purpose of this application.

hermanho commented 1 month ago

I struggled with this for a while before realizing it doesn't matter where the token is generated. I cloned the repo to my local workstation and ran the token generator there, where it opened the browser and I clicked through. Afterwards I put the resulting token.json into my host-mounted config directory.

Are you doing this every week? Hoping to figure out an automated way to generate new tokens because "publishing" the app in google (as recommended by install.md) seems wildly unrealistic given the requirements to do that in 2024.

Is there any reason to keep the OAuth app in testing? For my own version, I have published it.

In order to publish it, google says I need to complete all these steps for verification:

You've configured your app in a way that requires verification . To complete verification, you will need to provide: An official link to your app's Privacy Policy A YouTube video showing how you plan to use the Google user data you get from scopes A written explanation telling Google why you need access to sensitive and/or restricted user data All your domains verified in Google Search Console

Not sure if the issue is with how I configured the application when creating it, but none of these requirements seem reasonable to me given the purpose of this application.

It should not require the verification when publishing.

Screenshot 2024-06-05 下午11 53 28

Screenshot 2024-06-05 下午11 54 42

GioD commented 1 month ago

I struggled with this for a while before realizing it doesn't matter where the token is generated. I cloned the repo to my local workstation and ran the token generator there, where it opened the browser and I clicked through. Afterwards I put the resulting token.json into my host-mounted config directory.

Are you doing this every week? Hoping to figure out an automated way to generate new tokens because "publishing" the app in google (as recommended by install.md) seems wildly unrealistic given the requirements to do that in 2024.

Is there any reason to keep the OAuth app in testing? For my own version, I have published it.

In order to publish it, google says I need to complete all these steps for verification:

You've configured your app in a way that requires verification . To complete verification, you will need to provide: An official link to your app's Privacy Policy A YouTube video showing how you plan to use the Google user data you get from scopes A written explanation telling Google why you need access to sensitive and/or restricted user data All your domains verified in Google Search Console

Not sure if the issue is with how I configured the application when creating it, but none of these requirements seem reasonable to me given the purpose of this application.

It should not require the verification when publishing.

Screenshot 2024-06-05 下午11 53 28

Screenshot 2024-06-05 下午11 54 42

Sounds like I made a mistake when setting up the app in google. What, if any, scopes are required? I selected the relevant Google Photos Library scopes but perhaps that was not necessary and is likely the reason why publishing my app requires verification.

hermanho commented 1 month ago

I struggled with this for a while before realizing it doesn't matter where the token is generated. I cloned the repo to my local workstation and ran the token generator there, where it opened the browser and I clicked through. Afterwards I put the resulting token.json into my host-mounted config directory.

Are you doing this every week? Hoping to figure out an automated way to generate new tokens because "publishing" the app in google (as recommended by install.md) seems wildly unrealistic given the requirements to do that in 2024.

Is there any reason to keep the OAuth app in testing? For my own version, I have published it.

In order to publish it, google says I need to complete all these steps for verification:

You've configured your app in a way that requires verification . To complete verification, you will need to provide: An official link to your app's Privacy Policy A YouTube video showing how you plan to use the Google user data you get from scopes A written explanation telling Google why you need access to sensitive and/or restricted user data All your domains verified in Google Search Console

Not sure if the issue is with how I configured the application when creating it, but none of these requirements seem reasonable to me given the purpose of this application.

It should not require the verification when publishing. Screenshot 2024-06-05 下午11 53 28 Screenshot 2024-06-05 下午11 54 42

Sounds like I made a mistake when setting up the app in google. What, if any, scopes are required? I selected the relevant Google Photos Library scopes but perhaps that was not necessary and is likely the reason why publishing my app requires verification.

No logo, no app domain, no any scopes

GioD commented 4 weeks ago

This is likely my issue. I'll try removing these scopes and report back. Thanks for the info!