Skip to content

Fails to load with a token error #522

@ArthurMitchell42

Description

@ArthurMitchell42

Describe the bug

Fails to connect to server with a token expired error oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

Version of the custom_component

Current latest version 1.1.7

Configuration

No changes to defaults, this has been working for over a year without fault

Debug log

Logger: homeassistant.config_entries
Source: config_entries.py:637
First occurred: 20:02:15 (2 occurrences)
Last logged: 20:03:29

Error setting up entry Bosch for home_connect
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/homeconnect/api.py", line 81, in request
return getattr(self._oauth, method)(url, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/requests_oauthlib/oauth2_session.py", line 528, in request
url, headers, data = self._client.add_token(
~~~~~~~~~~~~~~~~~~~~~~^
url, http_method=method, body=data, headers=headers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 217, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 637, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/home_connect/init.py", line 328, in async_setup_entry
await update_all_devices(hass, entry)
File "/usr/src/homeassistant/homeassistant/components/home_connect/init.py", line 350, in update_all_devices
await hass.async_add_executor_job(hc_api.get_devices)
File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/home_connect/api.py", line 47, in get_devices
appl: list[HomeConnectAppliance] = self.get_appliances()
~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/homeconnect/api.py", line 146, in get_appliances
data = self.get(ENDPOINT_APPLIANCES)
File "/usr/local/lib/python3.13/site-packages/homeconnect/api.py", line 93, in get
res = self.request("get", endpoint)
File "/usr/local/lib/python3.13/site-packages/homeconnect/api.py", line 84, in request
self._oauth.token = self.refresh_tokens()
~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/home_connect/api.py", line 41, in refresh_tokens
).result()
~~~~~~^^
File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 537, in async_ensure_token_valid
new_token = await self.implementation.async_refresh_token(self.token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 118, in async_refresh_token
new_token = await self._async_refresh_token(token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 199, in _async_refresh_token
new_token = await self._token_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
...<5 lines>...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions