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.
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 examplehttps://hlth.io.mi.com/app/v1/data/get_fitness_data_by_watermark
) return401 {"code":2,"message":"auth err"}
.Here's what I've been able to figure out so far:
0
.micloud
library logs in with user-agent containingAPP/xiaomi.smarthome
, while the Mi Fitness app on my phone logs in withAPP/xiaomi.wearable
.micloud
library uses asid
ofxiaomiio
, while Mi Fitness app usesmiothealth
.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!