eWeLink API v2

I have tried using the new API ( ewelink-api-next) but have had no luck. I can obtain the authorization code, but I am unable to get a token. The error I receive is always error 405, “invalid code”. This result I get not only with my code but when trying to run the eWeLinkOAuthLoginDemo. Has anyone succeeded in running API v2?

1 Like

I tested without any issues. This is the operation video, please check.

Ensure that the redirect address filled in your APPID is:

Yes, the redirect address is correct. Also, the response I get is status 200 (OK) and the msg is “invalid code”. If the redirect address was incorrect then the msg would be “incorrect url” (I tried this and this was the response). So there is another problem because I receive the authorization code but either this code is not being inserted or is somehow invalid.

Here is the response during authorization:

clientId: "EGKosLVlG2g8JQMhG9WiLfqk2Bna7MjY"
redirectUrl: ""
grantType: "authorization_code"
state: "001"
nonce: "lp4ympr5"
seq: "1693474508033"
authorization: "PfiC42YKIvz4SiScIL17mfeeCcRyeGSpJInJjpeiUuw"

And here is the response when trying to get the token:

status: 200
responseTime: 528
error: 405
msg: "invalid code"
data: {}

The response time for the token indicates that the reply was almost immediate.

hi there, i’ve tried using postman to get access token, but the result was same error invalid code, how can i workaround it ?
i’ve tried to get the code from the autorization page as soon as possible, but there was same response

There are several ways to check the reasons:

  1. Replace with a better network environment for testing.

  2. Replace the logged in account with one that matches the actual geographical location. If the registered address of the account is too far from the current physical location, it may cause a delay in the request.

  3. Send the log file separately to me for confirmation:


how can i get the log file?
i can access the web without any problem

i’ve tried the GitHub - nocmt/eWeLinkOAuthLoginDemo but i cannot start the local web server
how can i get past the OAuth Login to get the code ?

Sorry for late reply, i’ve already got the project run, but recently my project was not running again
when i’m using the oaut login demo it return with error 412 invoke too much
what is that error ? how can i resolve that error ?

I also get the 'invoke too much" error - error number 412. How much is too much?

Cannot make more than 300 calls within 5 minutes. Please wait for 5 minutes and try again.