bimmer_connected: OSError: Authentication failed. Maybe your password is invalid? [resolved with api update on August 2021]

Describe the issue

I can’t connect anymore. Please help me

Logs :

ON LINUX : bimmerconnected lightflash xxxxx xxxxxx rest_of_world xxxxxxxxxxxxxxxxxxxxx

DEBUG:bimmer_connected.account:Getting vehicle list DEBUG:bimmer_connected.account:getting new oauth token DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): customer.bmwgroup.com:443 DEBUG:urllib3.connectionpool:https://customer.bmwgroup.com:443 “POST /gcdm/oauth/token HTTP/1.1” 400 None DEBUG:bimmer_connected.account:The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200). DEBUG:bimmer_connected.account:{“error”: “invalid_request”, “error_description”: “The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed”} ERROR:bimmer_connected.account:Authentication failed. Maybe your password is invalid? ERROR:bimmer_connected.account:The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200). Traceback (most recent call last): File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 102, in _get_oauth_token response = self.send_request(url, data=data, headers=headers, allow_redirects=False, File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 156, in send_request raise IOError(msg) OSError: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200). Traceback (most recent call last): File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 102, in _get_oauth_token response = self.send_request(url, data=data, headers=headers, allow_redirects=False, File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 156, in send_request raise IOError(msg) OSError: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200).

The above exception was the direct cause of the following exception:

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 240, in main args.func(args) File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/cli.py”, line 128, in light_flash account = ConnectedDriveAccount(args.username, args.password, get_region_from_name(args.region)) File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 66, in init self._get_vehicles() File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 218, in _get_vehicles self._get_oauth_token() File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 108, in _get_oauth_token raise OSError(msg) from exception OSError: Authentication failed. Maybe your password is invalid?

AND ON PYTHON3 :

account=bimmer_connected.account.ConnectedDriveAccount(username,password,france,None,5)

Authentication failed. Maybe your password is invalid? The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200). Traceback (most recent call last): File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 102, in _get_oauth_token response = self.send_request(url, data=data, headers=headers, allow_redirects=False, File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 156, in send_request raise IOError(msg) OSError: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200). Traceback (most recent call last): File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 102, in _get_oauth_token response = self.send_request(url, data=data, headers=headers, allow_redirects=False, File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 156, in send_request raise IOError(msg) OSError: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200).

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 66, in init self._get_vehicles() File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 218, in _get_vehicles self._get_oauth_token() File “/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py”, line 108, in _get_oauth_token raise OSError(msg) from exception OSError: Authentication failed. Maybe your password is invalid?

Is this normal ? It was working very well before.

Thanks

Expected behavior

I was hopping to connect as usual

Which Home Assistant version are you using?

I don’t use Home Assistant

What was the last working version of Home Assistant Core?

No response

What is your region?

Rest of world

ConnectedDrive website

  • I can still successfully login to the BMW ConnectedDrive website and the car status is available there.
  • I have ConnectedDrive enabled for my vehicle.

Number of cars

  • I have 2 or more cars linked to the ConnectedDrive account.
  • I have a Mini vehicle linked to my account.

Output of bimmer_connected fingerprint

bimmerconnected fingerprint XXXXXXX XXXX rest_of_world

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): customer.bmwgroup.com:443
ERROR:bimmer_connected.account:Authentication failed. Maybe your password is invalid?
ERROR:bimmer_connected.account:HTTPSConnectionPool(host='customer.bmwgroup.com', port=443): Max retries exceeded with url: /gcdm/oauth/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1012, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.9/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.9/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1123)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='customer.bmwgroup.com', port=443): Max retries exceeded with url: /gcdm/oauth/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 102, in _get_oauth_token
    response = self.send_request(url, data=data, headers=headers, allow_redirects=False,
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 140, in send_request
    response = requests.post(url, headers=headers, data=data, allow_redirects=allow_redirects,
  File "/usr/lib/python3/dist-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='customer.bmwgroup.com', port=443): Max retries exceeded with url: /gcdm/oauth/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1012, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.9/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.9/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1123)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='customer.bmwgroup.com', port=443): Max retries exceeded with url: /gcdm/oauth/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 102, in _get_oauth_token
    response = self.send_request(url, data=data, headers=headers, allow_redirects=False,
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 140, in send_request
    response = requests.post(url, headers=headers, data=data, allow_redirects=allow_redirects,
  File "/usr/lib/python3/dist-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='customer.bmwgroup.com', port=443): Max retries exceeded with url: /gcdm/oauth/token (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))

The above exception was the direct cause of the following exception:

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 240, in main
    args.func(args)
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/cli.py", line 115, in fingerprint
    account = ConnectedDriveAccount(args.username, args.password, get_region_from_name(args.region),
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 66, in __init__
    self._get_vehicles()
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 218, in _get_vehicles
    self._get_oauth_token()
  File "/usr/local/lib/python3.9/dist-packages/bimmer_connected/account.py", line 108, in _get_oauth_token
    raise OSError(msg) from exception
OSError: Authentication failed. Maybe your password is invalid?

Anything in the logs that might be useful for us?

I can connect to bmwconnected's app with this logins and on the website with the same logins I use for BMWCONNECTED API

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 23 (2 by maintainers)

Most upvoted comments

I am getting this error now since updating to latest version of HA:

Logger: bimmer_connected.account Source: /usr/local/lib/python3.9/site-packages/bimmer_connected/account.py:107 First occurred: 21:21:29 (8 occurrences) Last logged: 21:22:13

The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200). Traceback (most recent call last): File “/usr/local/lib/python3.9/site-packages/bimmer_connected/account.py”, line 102, in _get_oauth_token response = self.send_request(url, data=data, headers=headers, allow_redirects=False, File “/usr/local/lib/python3.9/site-packages/bimmer_connected/account.py”, line 156, in send_request raise IOError(msg) OSError: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200).

Unsurprisingly not working here (rest of world), probably can’t help with the work required to resolve, but will try if I can.

Seems like BMW has deactivated the APIs for the “old” Connected Drive app 😑 Are you all located in rest_of_world or in other regions?

There will be no quick workaround except MITM’ing the the My BMW app (which I have tried but not yet succeeded).

Please see #299 for more information/discussion.

We’ll definitely need some help on this one.