skydiver / ewelink-api

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

401 Authentication error with Phone Numbers #83

Closed ameer1234567890 closed 4 years ago

ameer1234567890 commented 4 years ago

I am getting 401 Authentication error with phone numbers as login email. I do use the country code and it gives 401 even for getRegion requests. I tried using another account with an email address and it works.

ttz642 commented 4 years ago

Have you tried using the phone number to log in directly with the app on a mobile? Sounds more likely a problem with the server than ewelink-api.

ameer1234567890 commented 4 years ago

Yes, I have tried and it works.

skydiver commented 4 years ago

hey @ameer1234567890

i was trying to make this change but i wasn't able to test (cannot use phone with my account, looks like the phone is only available on China)

maybe i can make a branch so you can test locally ?

ameer1234567890 commented 4 years ago

Yes please

skydiver commented 4 years ago

Hey @ameer1234567890

In the next days version 3.0 will be release with support for login using phone number.

You can test this branch: release/3.0.0

Let me know if works for you.

Thanks.-

ameer1234567890 commented 4 years ago

@skydiver I have tested and can confirm that release/3.0.0 branch works for login using phone number. I specified phone number as phoneNumber: '+9609977444' where +960 is the country code. I think it would be a better idea to make a note at class-instantiation.md to include country code as a prefix to phone number. Highly appreciated.

skydiver commented 4 years ago

Thanks for testing @ameer1234567890

Here is the updated document: https://github.com/skydiver/ewelink-api/blob/668d60419d8aa12163372e3d7d79d97756bb2f97/docs/class-instantiation.md

Do you have any suggestion? Feel free to update the file.