argrento / huami-token

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

Xiaomi doesn't return any linked wearables #35

Open SpinahVieh opened 3 years ago

SpinahVieh commented 3 years ago

When using the script to get the token with $ python huami_token.py -m xiaomi -e mail@gmail.com -p password123 --bt_keys, I receive an empty list of linked wearables.

Paste URL after redirection here.
https://hm.xiaomi.com/watch.do?code=ALSG_CLOUDSRV_123BBAEDABDOE
Token: ['ALSG_CLOUDSRV_123BBAEDABDOE']
Logging in...
Logged in! User id: 123456789
Getting linked wearables...
+-------------------------------------------------------------------------------+
| ID  | ACT |        MAC        |                   auth_key                    |
|-----+-----+-------------------+-----------------------------------------------|
+-------------------------------------------------------------------------------+

Obviously I have linked the Mi Band 6 to the Mi Fit app and followed the steps in #32 to get it to work in the first place.

SpinahVieh commented 3 years ago

Okay so after hours of research, it turns out that they changed the authentification method. While I don't have a solution for this, I was at least able to extract the token to get gadget bridge to work by doing the following:

  1. Install Notify for Mi Band
  2. Download Firmware 1.0.3.22 and install it with an "update" with Notify for Mi Band in it's settings.
  3. Install the modded Mi Fit 5.0.1 app from freemyband and pair the band with the app.
  4. Take AuthKey from the file created by freemyband.

I'm only typing this up in case it helps anyone else with the same issue.

argrento commented 3 years ago

Hello! Can't confirm that. Authentication from the Gadgetbridge issue 2360 is a authentication between Mi Band and app, not between app and a server. I just checked: for my Xiaomi account, script returns all auth keys for all devices.

If you use xiaomi login method, you do not need to specify e-mail and password (with keys -e and -p), because e-mail and pass will be prompted at the login page in your browser. Probably you have multiple accounts. Ensure that the user id in the Mi Fit app is equal to the user id printed by the script (Logged in! User id: ...).

SpinahVieh commented 3 years ago

Thanks for taking your time to look into this - especially since it's my incompetence to use it made you take the time. I'll close the issue then if the script still works as intended. I'm sure I used the same account tho. It's "solved" for me now through this alternative process.

argrento commented 3 years ago

I'd like to clarify,

  1. You have paired your Mi Band 6 with your Mi account and see this device in Mi Fit app.
  2. The user id in the script output and Mi Band is the same.
  3. You have a single device paired to your Mi account.
SpinahVieh commented 3 years ago
  1. Yes
  2. Interestingly no! Thanks for asking, I did not check that. It is interesting because I literally just reinstalled the app and logged in with the same credentials on both devices. So I guess that's why I don't receive any result, but since I use the same credentials, I have no idea what to do about it.
  3. Yes.

IMHO you can close this issue since it's apparently my fault for having two accounts. Sorry for taking your time like this.

argrento commented 3 years ago

Thanks for your answers!

Pi77Bull commented 2 years ago

I'm having the same issue. The script shows a different user id even though I'm using the same account.

Also, I can't see any devices in the 'Manage Devices' section on the Mi Account website, even though it's paired in the app.

mpope9 commented 2 years ago

I too see no linked devices. Repro steps:

  1. Create MI Account
  2. Login to Mi Fitness
  3. See an 'Account Not Registered' error while running the script.
  4. Link MI account through Zepp app.
  5. Successfully run script, see no 'linked wearables'
mpope9 commented 2 years ago

I was using the MiFitness App. Switching to the MiFit App seemed to register the device properly (although I think the app was renamed).