Solved Error 400: Invalid_Request when trying "npm run token"
-
Bonjour/hello!
I’m reinstalling MMM-GoogleAssistant after doing the latest Magic Mirror update (and my mirror being off for six months or so). I’m having issues with generating the new MMM-GoogleAssistant token.
I run “npm run token” in the MMM-GoogleAssistant folder, and the browser redirects me to Google to get my OAuth code. Google gives me the following error after I have logged in:
Access Blocked: ____'s request is invalid. You can't sign in because ____ sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error If you are a developer of ____, see error details Error 400: invalid_request
When clicking error details:
The out-of-band (OOB) flow has been blocked in order to keep users secure. Follow the Out-of-Band (OOB) flow Migration Guide linked in the developer docs below to migrate your app to an alternative method. Request details: access_type=offline response_type=code redirect_url= ___
Any suggestions for how I can work from here, or manually enter the token? Thanks!
-
Hi, since February 28, 2022, we have to use new OAuth for creating
credentials.json
file.
I think you use old format that why Google refuse itSo, Just check this wiki part to be in accord with new OAuth
-
@bugsounet you were right! my credentials were out of date, so that issue is fixed and I see the new little oauth site.
I do have another issue though - the script for “npm run token” is going straight to “done” after I say Y to install/reinstall MMM-GoogleAssistant token, so I can’t enter the code the website generates for me, and I get the “fatal: token assistant: tokenGA.json missing” error. Any suggestions?
-
I also tried npm run update in the MMM-GoogleAssistant directory since that resolved it for another user but it didn’t work for me, unfortunately, as I am up to date.
-
Hi,
- Can you inform me node version used ?
with
node -v
command
must be node v16.x- Can you try this in
MMM-GoogleAssistant
directory:
rm -rf node_modules package-lock.json npm run update npm run token
-
@bugsounet sure! I ran node -v and it shows I am running v18.11.0.
-
I tried the 3 lines od code above and still have the “done” issue.
-
can you past me what happen on
npm run token
thanks -
sure! please see below:
pi@raspberrypi:~/MagicMirror/modules/MMM-GoogleAssistant $ npm run token > MMM-GoogleAssistant@4.0.7 token > installer/token.sh Welcome to MMM-GoogleAssistant Token generator! Do you want to install/reinstall MMM-GoogleAssistant token? [Y/n] Your choice: y Opening OAuth URL. Return here with your code. If your browser will not open, you can copy/paste this URL: https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype&prompt=consent&response_type=code&client_id=1056813255520-sj1d3k0tdht863dnibig9qjctgv5799s.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fgoogleassistant.bugsounet.fr Paste your code: Done. pi@raspberrypi:~/MagicMirror/modules/MMM-GoogleAssistant $
-
You try with terminal or over ssh?
-
In the terminal.
-
and in ssh ?
-
SSH is new to me (this is my first Linux project) so I’ll try to learn it this evening and let you know how it goes!
-
Sorry for the delayed reply, I’m struggling to figure out how to connect via SSH from my Windows computer to my Pi.
I’m going to keep trying and I’ll let you know once I have it figured out!
-
Good news! I figured out how to use SSH from my Windows PC!
Bad news! Unfortunately I get the same result.
Here’s what I see:
pi@raspberrypi:~ $ cd ~/MagicMirror/modules/MMM-GoogleAssistant pi@raspberrypi:~/MagicMirror/modules/MMM-GoogleAssistant $ npm run token > MMM-GoogleAssistant@4.0.7 token > installer/token.sh Welcome to MMM-GoogleAssistant Token generator! Do you want to install/reinstall MMM-GoogleAssistant token? [Y/n] Your choice: y Opening OAuth URL. Return here with your code. If your browser will not open, you can copy/paste this URL: https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype&prompt=consent&response_type=code&client_id=1056813255520-sj1d3k0tdht863dnibig9qjctgv5799s.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fgoogleassistant.bugsounet.fr Paste your code: Done. pi@raspberrypi:~/MagicMirror/modules/MMM-GoogleAssistant $
-
Hi,
In the question:Do you want to install/reinstall MMM-GoogleAssistant token? [Y/n] Your choice:
I think you type the letter
y
and [Enter]
Bah … don’t press [Enter] only typey
and it will works -
Hahaha! That was it! What a funny mistake I made.
Thanks so much for your help, and for giving me an excuse to learn about SSH!
-
bugsounet