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

Problem Running node authorize.js #76

Open
raspberrypi9 opened this issue Nov 19, 2024 · 4 comments
Open

Problem Running node authorize.js #76

raspberrypi9 opened this issue Nov 19, 2024 · 4 comments

Comments

@raspberrypi9
Copy link

I generated an Oauth client ID in the Google interface and placed it in the file credentials.json in the MMM-GoogleCalendar directory. When I run: node authorize.js, it says:

MMM-GoogleCalendar: Error loading credentials Error: ENOENT: no such file or directory, open '/home/mjw/MagicMirror/modules/MMM-GoogleCalendar/token.json'

I tried cp credentials.json token.json but I got:

MMM-GoogleCalendar: Error loading credentials Error: The incoming JSON object does not contain a client_email field

I'm not sure what else to try now. If you would please offer some help, I would really appreciate it. Thank you.

@sdetweil
Copy link

can you edit the credentials.json

it is missing a field
The incoming JSON object does not contain a client_email field

did you provide all the info, and select the right type of credentials?

@raspberrypi9
Copy link
Author

I did download the credentials but it doesn't have a client_email field. Should it?
I tried hand editing it to add one but that didn't work
I am doing OAuth client ID
Also, I put the credentials file as credentials.json in the MMM-Google Calendar dir but it was looking for a token.js

@Michael053000
Copy link

We are currently using Node.js version 22.9.0 in our project, and we are encountering a deprecation warning related to the Punycode module alongside the MMM-GoogleCalendar: Error loading credentials Error: ENOENT: no such file or directory, open '~/MagicMirror/modules/MMM-GoogleCalendar/token.json'.

Could you please provide guidance on how to resolve or address this issue? Should we replace the Punycode module with an alternative, or are there any specific updates or configurations we should apply to avoid this warning?

Looking forward to your advice.

Thank you.

@Sebastardito
Copy link

Sebastardito commented Dec 1, 2024

Here the same, these are my outputs:


node@mm:/opt/magic_mirror/modules/MMM-GoogleCalendar$ node --trace-deprecation authorize.js
(node:229) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
at node:punycode:3:9
at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
at loadBuiltinModule (node:internal/modules/helpers:114:7)
at Function._load (node:internal/modules/cjs/loader:1100:17)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at require (node:internal/modules/helpers:141:16)
at Object. (/opt/magic_mirror/modules/MMM-GoogleCalendar/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
MMM-GoogleCalendar: Error loading credentials Error: ENOENT: no such file or directory, open '/opt/magic_mirror/modules/MMM-GoogleCalendar/token.json'
at async open (node:internal/fs/promises:638:25)
at async Object.readFile (node:internal/fs/promises:1238:14)
at async loadSavedCredentialsIfExist (/opt/magic_mirror/modules/MMM-GoogleCalendar/authorize.js:22:21)
at async authorize (/opt/magic_mirror/modules/MMM-GoogleCalendar/authorize.js:55:16) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/opt/magic_mirror/modules/MMM-GoogleCalendar/token.json'
}

And after "cp credentials.json token.json":


node@mm:/opt/magic_mirror/modules/MMM-GoogleCalendar$ node --trace-deprecation authorize.js
(node:346) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
at node:punycode:3:9
at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
at loadBuiltinModule (node:internal/modules/helpers:114:7)
at Function._load (node:internal/modules/cjs/loader:1100:17)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at require (node:internal/modules/helpers:141:16)
at Object. (/opt/magic_mirror/modules/MMM-GoogleCalendar/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
MMM-GoogleCalendar: Error loading credentials Error: The incoming JSON object does not contain a client_email field
at JWT.fromJSON (/opt/magic_mirror/modules/MMM-GoogleCalendar/node_modules/google-auth-library/build/src/auth/jwtclient.js:210:19)
at AuthPlus.fromJSON (/opt/magic_mirror/modules/MMM-GoogleCalendar/node_modules/google-auth-library/build/src/auth/googleauth.js:385:20)
at loadSavedCredentialsIfExist (/opt/magic_mirror/modules/MMM-GoogleCalendar/authorize.js:24:24)
at async authorize (/opt/magic_mirror/modules/MMM-GoogleCalendar/authorize.js:55:16)

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

4 participants