-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error 401: Wrong account or password -- again #220
Comments
Correction, sonoff devices also become errors. |
I found a temporary workaround. APP_ID: Uw83EKZFxdif7XFXEsrpduz5YyjP7nTl Thanks, LiorLindvor. |
after registering your ewelink account and creating app, did your app_id and secret_id work normally? |
I've had little problem finding correct directory under my portainer node-red install, found here: //data/node_modules/ewelink-api/src/data$ -if anyone has same problem. Using vi editor I have changed the credentials as above (or create your own under dev.ewelink.cc) and the auth problem solved now! |
@antonioGabrielGomes , all, With the above credentials from @nareso , I get full functionality. |
I did that but got the same error |
It could be the type of account we're creating, maybe individual developer access doesn't have permissions. |
Regarding authorization issues, accounts created by individual developers can only be redirected to the authorization page for login. So it cannot directly request the login interface to obtain a Token, the specific information is here: https://coolkit-technologies.github.io/eWeLink-API/#/en/OAuth2.0 |
Hi carl , thanks for your reply. I do not understand the Create application procedure, but how should I describe it in the redirect URL field? By the way, in my account, |
This is an example of eWeLink OAuth2.0 login:https://github.com/coolkit-carl/eWeLinkOAuthLoginDemo |
Hi carl, thank you very much for your kind explanation. But, I can't find config.js in ewelink-api directory. Please tell me the create application procedure when using ewelink-api. |
The file to overwrite keys from previous comments is in directory path i’ve mentioned specifically in case of a portainer install (NAS)- keys from ewelink.cc supposedly do not work, as written above |
the same here. |
Thanks for the info. Now, with the individual developer method, we can integrate with devices ? making a boost on the demo you sent? |
Uw83EKZFxdif7XFXEsrpduz5YyjP7nTl It is an APPID that should not be used, please ignore it. Through personal developer methods, it is possible to integrate with devices. I will add an example of obtaining device information and controlling devices later, but the specific content needs to be configured based on your device. |
Updated, feat: Add device examples to control the current login account |
@coolkit-carl can we say at least that it is really messy ?? On my side, my own app_id and app_secret doesn't work but this app_id works : Uw83EKZFxdif7XFXEsrpduz5YyjP7nTl Can you explain us how to easily use your ewelink-api-next to basically turn on/off a device please ? Documentation here : https://coolkit-technologies.github.io/eWeLink-API/#/en/OAuth2.0 |
1. Can you give an example of why you feel unstable? The v2 interface has been running and maintained for 3 years, and there have been no significant changes to the interface.
2. We have stopped maintaining the v1 interface. Its security is not as high as the v2 interface, and its functionality is not as comprehensive as the v2 interface. Stopping is inevitable.
3 https://github.com/coolkit-carl/eWeLinkOAuthLoginDemo <https://github.com/coolkit-carl/eWeLinkOAuthLoginDemo > I updated the latest document for this project yesterday and wrote about the entire process.
4. ewelink-api-next actually has basic examples. In the next few days, it will be open source and provide additional documentation for all functions (in fact, if you use TypeStript, you will get a more perfect prompt, and its source code also has annotations).
Dep:产品部|解决方案工程师
Name:刘家乐
***@***.*** ***@***.*** >
Tel:+86(0)755 26404901
Mob:+86 18598029557
------------------------------------------------------------------
发件人:thomas350 ***@***.***>
发送时间:2023年8月16日(星期三) 19:48
收件人:skydiver/ewelink-api ***@***.***>
抄 送:刘家乐 ***@***.***>; Mention ***@***.***>
主 题:Re: [skydiver/ewelink-api] Error 401: Wrong account or password -- again (Issue #220)
@coolkit-carl <https://github.com/coolkit-carl > can we say at least that it is really messy ??
Why Ewelink is disabling v1 interface while v2 interface does not work for production ?
On my side, my own app_id and app_secret doesn't work but this app_id works : Uw83EKZFxdif7XFXEsrpduz5YyjP7nTl
Which is really weird.
Can you explain us how to easily use your ewelink-api-next to basically turn on/off a device please ?
Documentation here : https://coolkit-technologies.github.io/eWeLink-API/#/en/OAuth2.0 <https://coolkit-technologies.github.io/eWeLink-API/#/en/OAuth2.0 >
Or here : https://github.com/coolkit-carl/eWeLinkOAuthLoginDemo <https://github.com/coolkit-carl/eWeLinkOAuthLoginDemo >
are clearly not understandable and seems to not be stable at all.
—
Reply to this email directly, view it on GitHub <#220 (comment) >, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AMDDIXVSHSAIYH2XMKDTXDTXVSXRZANCNFSM6AAAAAA3K5OG2Q >.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Does the method in the demo not work for 4ch devices? and does the library work to enable and disable devices in real time? |
|
Hi carl I noticed that the object structure has changed between V1 and V2. Could these changes be the reason that node-red-contrib-ewelink doesn't work properly with V2 interfaces? |
No, the action for controlling the device have not changed. We have only changed the interface domain name, path, and parameter transfer method. |
The change from V1 object {"switch":"off"} to V2 object {"switch":{"switch":"off"}} is a very big change for me. To which of the described changes does such a change apply? |
There is no change, {"switch": {"switch": "off"}} is incorrect. |
Here is my environment and results. Nod-red version : v3.0.2 Using V1 API Using V2 API please confirm. |
@coolkit-carl Can you explain us how to easily use your ewelink-api-next to basically turn on/off a 4ch device please ? Documentation here : https://coolkit-technologies.github.io/eWeLink-API/#/en/OAuth2.0 Thank you. |
Ok I have this working for my hallway 2 channel light switch. I can turn them on and off right now. in plain English:
AND MY LIGHTS TURNED ON....
So now I have a proof of concept working in Javascript, I can switch back to PHP and write real HTTP requests, that consume the OAuth Endpoint, which gives me a token to store, and then I can then just use any HTTP client (mine will continue to be PHP) to make http requests Once you have an access token from OAuth you can call any of the APIs - here is a scaled down request, made by standard curl --location 'https://eu-apia.coolkit.cc/v2/device/thing/status' \
--header 'X-CK-Nonce: 9e3NOTREALwR7' \
--header 'Authorization: Bearer 90e4e9c7de5NOTMYREALTOKENd36154e3bbc2' \
--header 'Content-Type: application/json' \
--data '{
"type": 1,
"id": "10007bc171",
"params": {
"switches": [
{"switch": "on", "outlet": 1}
]
}
}' The above all works in real life in my house today. Im not @coolkit-carl, Im a PHP dev with API experience :) If you are looking for a non-technical project where you can just input your username and password to a config file, and magically control your devices, then you can no longer do that. But if you are willing to learn basic development (like OAuth which is pretty much industry standard for authenticating and authorising external services nowadays) then that can be "easily" done. The old |
I will also just note that the OAuth 2.0 process they are using is crazy and non-standard. If it were standard OAuth then tools like PostMan would be able to get access tokens automatically. The Authorisation parameters are simply wrong for standard OAuth -https://coolkit-technologies.github.io/eWeLink-API/#/en/OAuth2.0?id=authorization-page-description (eg client_id is right clientId is non-standard etc.) The PostMan Collection/Environment provided as an example (https://coolkit-technologies.github.io/eWeLink-API/#/en/APICenterV2?id=postman-example), doesnt even support auto Oauth2.0 to get a bearer token :( so at the moment the only way to get/refresh your token is with the demo app that was provided as an example https://github.com/coolkit-carl/eWeLinkOAuthLoginDemo - or to hand code your OAuth authorisation signature as per the documentation on how to hash the authorisation signatures. |
Thank you for your detailed explanation. Now, when the V1 interface is deprecated, I would like an alternative environment for ewelink-api, but if anyone knows a recommended environment, please let me know. Development candidates that can control ewelink device with low code are
Any comments would be appreciated. |
@coolkit-carl Can you show a valid example of token refresh? |
|
@coolkit-carl . I have registered and received my APPID and APPsecret, used both to update ewelink api in node-red on the rpi. I receive all info on my own devices on NodeRed using "devices" node. IT WORKS !!! Problem: HOW can I set to also receive info on devices shared with me by others in "devices" node? ( Note: on Home Assistant I am receiving info from both my own sonoff devices, and from sonoff devices shared with me by other users. BUT, it does not work the same in NodeRed) UPDATE: I tested NodeRed "event listener". There I do receive info from devices shared with me |
Please provide me with a shared device ID, and I will check the device status for you. In theory, this situation can only occur on the device shared with you, and its brand is not included in the free authorization list of eWeLink. |
@coolkit-carl, I confirm the same behavior reported by @AndreFvdMerwe. |
my own device: 10017c1e94 |
10017c1e94 SONOFF UIID181, switch control command: {"switch": "on"} or {"switch": "off"} 10017c198a is also the same, theoretically no problem. I think it is still necessary to check the code and return to ensure that all devices have been obtained (please refer to my code example: https://github.com/coolkit-carl/ewelink-api-next/blob/main/src/web/apis/device/getAllThings.ts ). I am sure that under normal parameter transmission, this device information will definitely be returned |
1000a4f037 SONOFF UIID1 a socket, The same as my previous answer, we do not restrict the return of information on this device (its brand is licensed to you for free) |
1 similar comment
1000a4f037 SONOFF UIID1 a socket, The same as my previous answer, we do not restrict the return of information on this device (its brand is licensed to you for free) |
Good afternon, ive been following this chat and I am very curious if there is a way to toggle ewelink smart switches directly via internal network using curl. I do not see why a simple toggle needs to be done via third party apis Also has anyone figured out a way to do all of the above via curl since so that switch can be attached to node red since after to going over the thread, I still don't have a clear idea on how to do this with node red. Thanks |
I was using ewelink node red module for a couple of years to control my solar system. Now get devices node is working but SET state or GET state nodes are not working and show: There are any "how to" to solve it because I'm not a developer and I don't understand very well what is the issue Thanks in advance |
There are a procces to renew token and I used it, but only work for me in a short time after get token, then when I try to refesh token I get this: |
Explanation on rt invalidation: If you use the same APPID, account, request login, refresh token, reset password, or other interfaces or behaviors, it will return a new at, rt, and cause the previous login credentials to become invalid. |
Then , what can I do to refresh token when the token are expired or before expired? Because in short time i received this: |
|
{"status":200,"responseTime":257,"error":401,"msg":"cannot found access token info","data":{}} I call the function refreshToken like that: And I get always the same error { then when you say that I have to reset it , is that I have to login again? Because this happend after short time.. Thanks! |
Ok this is the case, Mi application login with oauth demo, I login manually and obtain the token. then all work correcty on mi application, after some time I received this mensage when the application try to control some device: : {"status":200,"responseTime":257,"error":401,"msg":"cannot found access token info","data":{}} I call the function refreshToken like that: And I get always the same error { then when you say that I have to reset it , is that I have to login again? Because this happend after short time.. Thanks! |
It looks like it has been reset. You need to log in again. It is recommended to check the code to see if there are any other places that will refresh this token, as each refresh will reset at and rt. |
Hi this is the code... import { client } from '../../config.js' import * as fs from 'fs' export async function SonoffChangeState (ctx) {
} |
HI, I think that is not error on my application, I have another application that connect to websocket with the same APP_ID AND APP_SECRET with the old api ewelink-api. ¿may be? I need to created another app en https://dev.ewelink.cc/ , but there is not possible.. |
It is recommended to share a token or split the devices into two accounts and share them with another account. |
Yes, i will do it thanks |
I managed to patch this repo in my fork. It works on my Sonoff S31 plug, but I haven't tested on other devices. I only spent a few hours as I needed to get it to work asap. Therefore, I haven't patched every function, don't expect it to work well on other devices. The changes between v1 and v2 API are minimal.
If you look at the diff, it's not that much. I belive this project can be patched to migrate to v2 API entirely with minimal effort. |
Hello! I managed to get the token, I would like to continue using node-red-contrib-ewelink |
I got an Error 401 same as #212 today.
#212
This error does not occur with sonoff devices but occurs with 4ch products that have the PSF-B04 module when using setDevicePowerState methods.
Is there anyone with the same symptoms?
The text was updated successfully, but these errors were encountered: