skydiver / ewelink-api

eWeLink API for JavaScript
https://www.npmjs.com/package/ewelink-api
MIT License
264 stars 108 forks source link

{ error: 406, msg: 'Authentication failed' } I am using right email and password #232

Open demokedes opened 2 months ago

demokedes commented 2 months ago

Dear all, I am new to ewelink API. I tried to start using it, but I am constantly receiving an error: { error: 406, msg: 'Authentication failed' } For sure, I am using right email and password, because I can login without any problem on ewelink portal. The problem might be in region. In the script, I am selecting 'eu', which should be the right region for Europe, but on the portal on the drop down menu, I select Slovenia, because there is no eu option. What should be the reason. Are there any requirement, to use this api? Do I need to have an advanced plan maybe? Regards, Rok

mduchain commented 2 months ago

The usual suspects are

no need for any plan, I'm using the api fine without.

demokedes commented 2 months ago

@mduchain , thank you for your answer. old APP_ID might be the reason, but I don't know how to overcome it. What to do now. I am not using it on mobile app at the same time. Because of that I am having two different accounts, primary one that I am using on my mobile app, than I am having secondary one, that is shared through primary. This secondary's purpose is to connect through node-red, but I am getting this error. Any idea how to solve it?

mduchain commented 2 months ago

you need to check the APP_ID and APP_SECRET in constants.js Use the ones mentioned in #221 - those are the ones I'm using. APP_ID: 'Uw83EKZFxdif7XFXEsrpduz5YyjP7nTl', APP_SECRET: 'mXLOjea0woSMvK9gw7Fjsy7YlFO4iSu6'

find your nodered node_modules folder, the constants.js file is in

/ewelink-api/src/data/constants.js The account I'm using has been created in region 'eu', should work fine for you as well. I found out that the event listener node does NOT work with shared accounts. It's a permission thing. I had to use the secondary account on my app, which is very annoying because then there are certain restrictions on the actions the app can perform, like network settings, upgrading, schedules, etc ...