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

Auth error [Cannot read property '0' of undefined] #106

Open
shrekmaster opened this issue Jul 22, 2022 · 1 comment
Open

Auth error [Cannot read property '0' of undefined] #106

shrekmaster opened this issue Jul 22, 2022 · 1 comment

Comments

@shrekmaster
Copy link

Trying to execute the code with client_secret json file. When I put the path in the code and try to execute after installing node module, get the following error

`/google-assistant/components/auth.js:26
const oauthClient = new OAuth2Client(key.client_id, key.client_secret, key.redirect_uris[0]);
^

TypeError: Cannot read property '0' of undefined
at new Auth (/google-assistant/components/auth.js:26:91)
at new GoogleAssistant (/google-assistant/index.js:33:18)
at Object. (/google-assistant/examples/console-input.js:60:19)
`

Any idea what I may be doin wrong here? client secret json file created and authenticated. It also works fine with another code that I have tried before

@apop880
Copy link

apop880 commented Dec 13, 2022

I had to add "redirect_uris": ["https://localhost:3000"] to the "installed" section of my key JSON file. The URI itself doesn't really matter, but if you put it at localhost, it doesn't check for validity. I'd pick a port where you don't currently have something running. Then, when you get redirected, no page will load, but you just need to copy the code section of the URI from your address bar and paste that in to complete authentication.

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

2 participants