ewelink-api: Error: 406 { error: 406, msg: 'Authentication failed' }
I have been using the Node ewelink-api for years and really do like the automation it gives me. I wrote about it here: https://kevinsaye.wordpress.com/2020/11/03/home-automation-creating-an-azure-function-to-control-sonoff-via-ewelink/
In the last few days, I noticed it stopped working and I got the error message: { error: 406, msg: ‘Authentication failed’ }
Following #220 , I tried to use the APP_ID and APP_SECRET which resolved it. Documenting this issue here, in hopes it gets updated in the source and that others can get a quick fix.
Failing code, that worked for years:
const ewelink = require('ewelink-api');
const connection = new ewelink({
email: '*************',
password: '**********',
region: 'us'
});
(async () => {
const bb = await connection.getDevices();
console.log(bb);
})();
Response:
{ error: 406, msg: 'Authentication failed' }
New code:
const ewelink = require('ewelink-api');
const connection = new ewelink({
email: '*************',
password: '***********',
region: 'us',
APP_ID: 'Uw83EKZFxdif7XFXEsrpduz5YyjP7nTl',
APP_SECRET: 'mXLOjea0woSMvK9gw7Fjsy7YlFO4iSu6'
});
(async () => {
const bb = await connection.getDevices();
console.log(bb);
})();
Response (real JSON removed for sensitivity reasons):
[{*****}]
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 21
It feels like this is something that will happen soon again.