Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Token on Docker #158

Open
elgeorgie opened this issue Jan 30, 2023 · 14 comments
Open

Generate Token on Docker #158

elgeorgie opened this issue Jan 30, 2023 · 14 comments

Comments

@elgeorgie
Copy link

elgeorgie commented Jan 30, 2023

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
Copy link

I have the same as well

@elgeorgie
Copy link
Author

I have the same as well

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

@elgeorgie
Copy link
Author

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
Copy link

bgreen87 commented Apr 21, 2023

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
Copy link

labaland commented May 5, 2023

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

@treyturner
Copy link

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
Copy link

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
Copy link

GioD commented Jun 5, 2024

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
Copy link
Owner

hermanho commented Jun 5, 2024

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
Copy link

GioD commented Jun 5, 2024

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
Copy link
Owner

hermanho commented Jun 5, 2024

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
Copy link

GioD commented Jun 5, 2024

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
Copy link
Owner

hermanho commented Jun 6, 2024

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
Copy link

GioD commented Jun 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants