argrento / huami-token

Script to obtain watch or band bluetooth token from Huami servers
MIT License
410 stars 94 forks source link

404 Error after logged by XIaomi Account #55

Open Zxis233 opened 2 years ago

Zxis233 commented 2 years ago

I bond the Miband 6 with Mi Fit. But after I clicked the link and logging, the return code was 404 and it said that routes not found. Could you help me? I've reset the band and reconnected it with Mi Fit several times, but it didn't work.

argrento commented 2 years ago

Does this error shown after you log in?

y-lee commented 2 years ago

I have the same error message after clicking on the URL the script provides, and logging in with a Xiaomi account:

{"code":404,"message":"routes not found"} I have Bip Lite, and successfully used this script with the same device/account several months ago to obtain the Bluetooth access token, so it's a recent change.

murtoz commented 2 years ago
to add my device is a mi band 6. I also have this issue. Unsure what the solution is? I checked the other issue but that is for amazfit. I have a xiaomi account. Same exact symptoms as the other people in this thread. start the script with my xiaomi login credentials: `python3 huami_token.py --method xiaomi --email myemail@address.com --password mypassword --bt_keys` This then asks me to open this url: `https://account.xiaomi.com/oauth2/authorize?skip_confirm=false&client_id=19digitnumber&pt=0&scope=1+6000+16001+20000&redirect_uri=https%3A%2F%2Fhm.xiaomi.com%2Fwatch.do&_locale=en_US&response_type=code` I do this, sign in with my xiaomi account, give permission for the zepp app, and it goes to this url, after first giving me a certificate error (name missmatch between zepp and xiaomi): `https://hm.xiaomi.com/watch.do?code=AZAMSSRV_D96AE3D2EAE1617A964617F8F423A417` Which shows: `{"code":404,"message":"routes not found"}` If I then paste this url back into the script, I get ``` Token: ['AZAMSSRV_C7B081F384152FA752D9B2426B2B7EB5'] Logging in... Traceback (most recent call last): File "huami_token.py", line 353, in device.login() File "huami_token.py", line 144, in login raise ValueError(f"Login error. Error: {error_message}") ValueError: Login error. Error: 0117. Account not registered. ```
murtoz commented 2 years ago

Ok so I managed to fix my issue by sheer luck. I tried downloading my data directly from the mi fit app (about => compliance) and got an email but when I tried to log in there it said account not registered. I had to add a xiaomi account in the mi fit app (even though I think I set one up when i first used the mi fit app). I was then able to download my data and I figured why not try this again. Now running through the above steps again and everything is the same including the 404 error; except for the very last step: when I paste the url it now sees my device and displays the bt key. I have since succesfully used this with gadgetbridge. Thank you for your amazing work!

kwozyman commented 2 years ago

Be advised, I was able to get the auth_key for a MiBand 6 by using amazfit method.

y-lee commented 2 years ago

I am pleased to report that this issue is fixed with the current pull.