Unable to generate cookie, getting 404 (not found)
VittorioAccomazzi opened this issue · comments
Describe the bug
I used the code below ( suggested by this blog ) to connect to Alexa and have to to speak. email
and password
are correct for sure, we are getting a 404
every time.
To Reproduce
create simple node application :
- npm i alexa-remote2
- cut and paste the code below in
index.js
- run
node index.js
let Alexa = require('alexa-remote2');
let alexa = new Alexa();
alexa.init({
email: '-----', //
password: '----', //
bluetooth: false,
logger: console.log, // optional
alexaServiceHost: 'alexa.amazon.it',
acceptLanguage: 'it-IT',
amazonPage: 'amazon.it',
useWsMqtt: true
},
function (err) {
if (err) {
console.log (err);
return;
}
alexa.sendCommand("RZ", "Ciao", null, function (err, payload) {
if (err) {
console.log(err);
return;
}
console.log(payload);
});
}
);
Expected behavior
Alexia should say "Ciao" using the italian language.
Observed behavior
the application reports an error, see below.
Screenshots & Logfiles
Alexa-Cookie: Step 3: login with filled form, referer contains session id
Alexa-Cookie: Sending Request with {"host":"www.amazon.it","path":"/ap/signin","method":"POST","headers":{"DNT":"1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36","Accept-Language":"it-IT","Connection":"keep-alive","Content-Type":"application/x-www-form-urlencoded","Referer":"https://www.amazon.it/ap/signin/-","Cookie":"session-id=-; session-id-time=-; session-token=-; ubid-acbit=-; at-acbit=-; lc-acbit=-; x-acbit=-; x-wl-uid=-; sess-at-acbit=-; UserPref=-","Accept":"*/*"},"gzip":true,"body":"email=----&password=-----"}
Alexa-Cookie: Response (404)
Alexa-Remote: Error from retrieving cookies
Error: Login unsuccessfull. Please check credentials.
at /home/pi/remotemonitoring/Alexa/node_modules/alexa-cookie2/alexa-cookie.js:368:50
at IncomingMessage.<anonymous> (/home/pi/remotemonitoring/Alexa/node_modules/alexa-cookie2/alexa-cookie.js:111:33)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Versions:
- Adapter version:
4.1.1
- JS-Controller version: not installed
- Node version:
v12.22.6
- Operating system: raspberry pi 4 version
Raspbian GNU/Linux 10 (buster)
Additional context
When I manually log in, I see that the url used in the POST are correct. I'm really not clear what is going wrong.
Ääähhmmmm ... then the bloog is outdated ... the username/password login is not reliable working since ages because Amazon increased the security measures a lot and most of the time a captcha or MFA needs to be provided for login. please use the proxy way to get a token
@Apollon77 thank you very much !. The proxy requires a manual intervention, am I correct ?
Yes but only one time and then you should store the returned data and can reuse in next call and it also refreshes automatically
@Apollon77 thank you !