Bugsounet Coding

    • Register
    • Login
    • Search
    This Forum is now reserved to registred users!

    Solved Error 400: Invalid_Request when trying "npm run token"

    Issues
    2
    17
    100
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hellothere last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • bugsounet
        bugsounet Main Coder last edited by

        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 it

        So, Just check this wiki part to be in accord with new OAuth

        H 1 Reply Last reply Reply Quote 0
        • H
          hellothere @bugsounet last edited by

          @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?

          1 Reply Last reply Reply Quote 0
          • H
            hellothere last edited by

            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. 🙂

            1 Reply Last reply Reply Quote 0
            • bugsounet
              bugsounet Main Coder last edited by bugsounet

              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
              
              H 1 Reply Last reply Reply Quote 0
              • H
                hellothere @bugsounet last edited by

                @bugsounet sure! I ran node -v and it shows I am running v18.11.0.

                1 Reply Last reply Reply Quote 0
                • H
                  hellothere last edited by

                  I tried the 3 lines od code above and still have the “done” issue. 😞

                  1 Reply Last reply Reply Quote 0
                  • bugsounet
                    bugsounet Main Coder last edited by

                    can you past me what happen on npm run token thanks

                    1 Reply Last reply Reply Quote 0
                    • H
                      hellothere last edited by

                      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 $ 
                      
                      
                      1 Reply Last reply Reply Quote 0
                      • bugsounet
                        bugsounet Main Coder last edited by

                        You try with terminal or over ssh?

                        1 Reply Last reply Reply Quote 0
                        • H
                          hellothere last edited by

                          In the terminal. 🙂

                          1 Reply Last reply Reply Quote 0
                          • bugsounet
                            bugsounet Main Coder last edited by

                            and in ssh ?

                            1 Reply Last reply Reply Quote 0
                            • H
                              hellothere last edited by

                              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!

                              1 Reply Last reply Reply Quote 0
                              • H
                                hellothere last edited by

                                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!

                                1 Reply Last reply Reply Quote 0
                                • H
                                  hellothere last edited by

                                  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 $
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • bugsounet
                                    bugsounet Main Coder last edited by

                                    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 type y 🙂
                                    and it will works 🙂

                                    1 Reply Last reply Reply Quote 0
                                    • H
                                      hellothere last edited by

                                      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! 🙂

                                      1 Reply Last reply Reply Quote 1
                                      • Topic has been marked as solved  bugsounet bugsounet 
                                      • First post
                                        Last post
                                      Powered by NodeBB | @bugsounet ©2022