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.