micloud icon indicating copy to clipboard operation
micloud copied to clipboard

Can this be used for health (Mi Fitness) API?

Open ghost opened this issue 2 years ago • 0 comments

I'm trying to use the API at hlth.io.mi.com. I can successfully log in and view my device list, but trying to make requests to the health API (for example https://hlth.io.mi.com/app/v1/data/get_fitness_data_by_watermark) return 401 {"code":2,"message":"auth err"}.

Here's what I've been able to figure out so far:

  • This is a separate error from an incorrect token altogether; that would return 401 with inner code 0.
  • micloud library logs in with user-agent containing APP/xiaomi.smarthome, while the Mi Fitness app on my phone logs in with APP/xiaomi.wearable.
  • Similarly, micloud library uses a sid of xiaomiio, while Mi Fitness app uses miothealth.
  • Trying to change either of the above results in a "captcha required" error on login step 1.

I'm way out of my depth here. Are you by any chance able to help figure out why this is happening? I'm happy to share (in private) network logs from the app on my phone, including login flow.

Thanks!

ghost avatar Dec 26 '22 07:12 ghost