bimmer_connected: Login failed for china
Describe the issue
Can’t login MyBMW account.
Expected behavior
seems the authentication scheme changed by BMW?
Which Home Assistant version are you using?
2023.1.0.dev20221205
What was the last working version of Home Assistant Core?
No response
What is your region?
China
MyBMW website
- I can still successfully login to the BMW MyBMW website and the car status is available there.
- I have MyBMW enabled for my vehicle.
Number of cars
- I have 2 or more cars linked to the MyBMW account.
- I have a Mini vehicle linked to my account.
Output of bimmer_connected fingerprint
No response
Anything in the logs that might be useful for us?
root@raspberrypi:~# bimmerconnected fingerprint 86xxxxxxxxxxx xxxxxxxx china
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.api.authentication:Authenticating with MyBMW flow for China.
DEBUG:httpx._client:HTTP Request: GET https://myprofile.bmw.com.cn/eadrax-coas/v1/cop/publickey "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://myprofile.bmw.com.cn/eadrax-coas/v2/login/pwd "HTTP/1.1 422 Unprocessable Entity"
ERROR:bimmer_connected.api.authentication:Authentication error: {"data":null,"code":499100,"error":true,"msgType":"toast","description":"请前往应用市场获取最新版本"}
Traceback (most recent call last):
File "/usr/local/bin/bimmerconnected", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/cli.py", line 302, in main
loop.run_until_complete(args.func(args))
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/cli.py", line 147, in fingerprint
await account.get_vehicles()
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 88, in get_vehicles
await self._init_vehicles()
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 66, in _init_vehicles
vehicles_responses: List[httpx.Response] = [
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 67, in <listcomp>
await client.get(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1757, in get
return await self.request(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1533, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1620, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1645, in _send_handling_auth
request = await auth_flow.__anext__()
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/api/authentication.py", line 76, in async_auth_flow
await self.login()
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/api/authentication.py", line 119, in login
token_data = await self._login_china()
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/api/authentication.py", line 286, in _login_china
handle_http_status_error(ex, "Authentication", _LOGGER)
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/api/utils.py", line 60, in handle_http_status_error
raise ex
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/api/authentication.py", line 274, in _login_china
response = await client.post(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1848, in post
return await self.request(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1533, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1620, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1648, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1706, in _send_handling_redirects
raise exc
File "/usr/local/lib/python3.9/dist-packages/httpx/_client.py", line 1688, in _send_handling_redirects
await hook(response)
File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/api/authentication.py", line 354, in raise_for_status_event_handler
response.raise_for_status()
File "/usr/local/lib/python3.9/dist-packages/httpx/_models.py", line 745, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '422 Unprocessable Entity' for url 'https://myprofile.bmw.com.cn/eadrax-coas/v2/login/pwd'
For more information check: https://httpstatuses.com/422
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (12 by maintainers)
Thanks @Yixi!! With https://github.com/home-assistant/core/pull/93180 merged this is included in HA 2023.5.4 or latest 2023.5.
I have submitted a pull request and am waiting for it to be merged. https://github.com/bimmerconnected/bimmer_connected/pull/534
We are still on the very old version for china due to BMW changing the login secrets in both 2.7.0 and 2.9.0 leading to not being able to login anymore. See https://github.com/bimmerconnected/bimmer_connected/discussions/488 for more info.
I was not able to figure out the new login yet (and don’t have much time right now). So any support there is appreciated.
@lanceliao check this https://blog.nviso.eu/2022/08/18/intercept-flutter-traffic-on-ios-and-android-http-https-dio-pinning/ This works for me for the rest of world version if the apk is patched with objection and using mitmproxy in wireguard mode.