argrento / huami-token

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

method amazfit - ValueError: Wrong E-mail or Password.Error: ['401'] #57

Closed zibous closed 2 years ago

zibous commented 2 years ago

I created a Zepp account using the same email and password for my AMAZFIT GTR. Zepp APP works. method xiaomi works - but no auth_key

To login with your Zepp credentials, use --method amazfit parameter, get error: ValueError: Wrong E-mail or Password.Error: ['401']

python3 huami_token.py --method amazfit --email ******* --password ******** --bt_keys

Result:

AUTH: https://api-user.huami.com/registrations/*******/tokens {
     'state': 'REDIRECTION', 
     'client_id': 'HuaMi', 
     'password': '********', 
     'redirect_uri': 'https://s3-us-west-2.amazonws.com/hm-registration/successsignin.html', 
     'region': 'us-west-2', 
     'token': 'access', 
     'country_code': 'US'
     }

REDIRECT: ParseResult(scheme='https', 
                      netloc='s3-us-west-2.amazonws.com', 
              path='/hm-registration/successsignin.html', 
                      params='', 
                      query='error=401&state=REDIRECTION&region=eu-central-1', fragment='') {
                         'error': ['401'], 
                         'state': ['REDIRECTION'], 
                         'region': ['eu-central-1']
                      }

Traceback (most recent call last):
  File "/Users/******/huami-token/huami_token.py", line 356, in <module>
    device.get_access_token()
  File "/Users/*****/huami_token.py", line 105, in get_access_token
    raise ValueError(f"Wrong E-mail or Password." \
ValueError: Wrong E-mail or Password.Error: ['401']

It looks like that the REDIRECT is the problem.

How can i fix this ? Thanks

argrento commented 2 years ago

I will check this and #55. Looks like they are related to each other.

zibous commented 2 years ago

@argrento 👍 thanks

It looks like that the zep app is connecting to: api-mifit-de2.huami.com.

Bildschirmfoto 2022-01-20 um 08 13 12

zibous commented 2 years ago

@argrento

Now it worked.

I installed the ZEPP app on my second cell phone and there I can reset the password before logging into the ZEPP account, then assigned a new password and with the new password I received the auth_key.

I haven't found any other way to reset the password using, - only the ZEPP app.

Getting access token with amazfit login method...
https://api-user.huami.com/registrations/.....
REDIRECT: ParseResult(scheme='https', netloc='s3-us-west-2.amazonws.com', path='/hm-registration/successsignin.html', params='', query='state=REDIRECTION&region=eu-central-1&access=****&country_code=AT&expiration=1643543397', fragment='') {'state': ['REDIRECTION'], 'region': ['eu-central-1'], 'access': ['****'], 'country_code': ['AT'], 'expiration': ['1643543397']}
Logging in...
Logged in! User id: *****
Getting linked wearables...

Thanks.