dolanmiu / MMM-awesome-alexa

Turn your MagicMirror into an 'Amazon Echo'. Activated when you say 'Alexa'.
https://awesome-alexa.js.org
MIT License
157 stars 51 forks source link

Authorization code - Invalid Authentification #180

Open zikotrance opened 5 years ago

zikotrance commented 5 years ago

Hi guys, i've been truggling with this issue for few days now and really appreciate your help. Once I get the authorization code from https://magic-mirror-avs.github.io/Alexa-Web-Helper/authresponse?code=xxxxxxxxxxx I get this code as follow: At the bottom you can see trying tGestting response from Amazon in LOOP

I don't know what I'm doing wrong:

Welcome to the Config Helper tool! This tool will help you get the Refresh Token needed to run MMM-awesome-alexa. It will optionally generate your config for you, if you wish. If not, you can still create it manually after. Go to https://developer.amazon.com/alexa/console/avs/products to get the details.

? Enter your Client ID from Alexa Voice Service (AVS): xxxxxxxxxxxxxxxxxxxxxxxxxxx ? Enter your Client Secret from Alexa Voice Service (AVS): xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ? Enter your Product ID from Alexa Voice Service (AVS): xxxxx ? Enter your Redirect URI (allowed return URL) from Alexa Voice Service (AVS): https://magic-mirror-a vs.github.io/Alexa-Web-Helper/authresponse Hooray! Link is generated. Part 1 is done. Please go on the link below.

Please be aware that at the end, THERE WILL BE AN ERROR! This is normal.

https://www.amazon.com/ap/oa?client_id=amzn1.application-oReplacingMyAuthCodeWithThis&scope=alexa:all&scope_data={"alexa:all":{"productID":"M1","productInstanceAttributes":{"deviceSerialNumber":123}}}&response_type=code&redirect_uri=https://magic-mirror-avs.github.io/Alexa-Web-Helper/authresponse

^^^ Copy and paste the above in your Browser ^^^, follow the instructions. The authorization code you want is in the address bar in the final screen: https://imgur.com/a/6DbYlKD ? Enter your Authorization code (from previous step): xxxxxxxxxxxx (I get this code from auto response URL)

â¡ Getting response from Amazon...(node:11412) UnhandledPromiseRejectionWarning: StatusCodeError: 400 - {"error":"invalid_grant","error_description":"The request has an invalid grant parameter : code"}

at new StatusCodeError (/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_modules/request/request.js:186:22)
at Request.emit (events.js:198:13)
at Request.<anonymous> (/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_modules/request/request.js:1081:10)
at Request.emit (events.js:198:13)
at IncomingMessage.<anonymous> (/home/pi/MagicMirror/modules/MMM-awesome-alexa/node_modules/request/request.js:1001:12)
at Object.onceWrapper (events.js:286:20)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

(node:11412) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:11412) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

âGetting response from Amazon...^C

Zpider23 commented 5 years ago

I’d recommend using Assistant Mk2. I had the same issue and couldn’t get it resolved no matter what I did

Sent with GitHawk

carlosrmz2920 commented 4 years ago

Did you add https://magic-mirror-avs.github.io/Alexa-Web-Helper/authresponse to the AVS allowed return url on Amazon Developer site?

filipdns commented 1 year ago

Hello, Same issue for me, what I have to fill on URI and return URL? Thanks for your help Philippe