tolwi / hassio-ecoflow-cloud

EcoFlow Cloud Integration for Home Assistant
353 stars 60 forks source link

Ecoflow River Pro - iot-auth/app/certification endpoint fails #35

Closed svenzik closed 1 year ago

svenzik commented 1 year ago

Hi. First of all, i'd like to thank you about all the job, well done.

I have Ecoflow River Pro and I was able to add the integration, but all values shown for the device have value 0. Could not find any more information from home-assistant log.

I looked at the code and tried tracing back the steps to find out what goes wrong.

  1. login is ok:
curl -v https://api.ecoflow.com/auth/login -H 'lang:en_US' -H 'content-type:application/json' \
  -d '{"email": "xxx@gmail.com", "password": "xxx", "scene": "IOT_APP", "userType": "ECOFLOW"}'

Response body:

{"code":"0","message":"Success","data":{"user":{"userId":"123","email":"xxx@gmail.com","name":"EcoFlow User","icon":"https://websiteoss.ecoflow.com/user/icon/123/wave.png","state":0,"regtype":"email","createTime":"2020-01-01 00:00:00","destroyed":"NORMAL","registerLang":"en_US","source":"IOT_APP","administrator":false,"appid":123},"token":"long_token"}}  
  1. certification fails with http code 405 (method not allowed)
curl -v https://api.ecoflow.com/iot-auth/app/certification -H 'lang:en_US' \
  -H 'authorization: Bearer long_token' \
  -d '{"userId": 123}'

< HTTP/2 405 
< date: Wed, 22 Mar 2023 06:56:16 GMT
< content-type: application/json; charset=UTF-8
< content-length: 45
< vary: Origin
< vary: Access-Control-Request-Method
< vary: Access-Control-Request-Headers
< allow: GET
< strict-transport-security: max-age=15724800; includeSubDomains
< 
* Connection #0 to host api.ecoflow.com left intact
{"code":"405","message":"Method Not Allowed"}

Am I missing some configuration on ecoflow app or web page so that the certification API endpoint would work?

svenzik commented 1 year ago

Closing issue - ecoflow api uses body with GET method. -X GET was missing from parameters. Sorry for unnessesary issue.