Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to authenticate: invalid_grant #126

Open
scaarup opened this issue Aug 29, 2022 · 6 comments
Open

Unable to authenticate: invalid_grant #126

scaarup opened this issue Aug 29, 2022 · 6 comments

Comments

@scaarup
Copy link

scaarup commented Aug 29, 2022

Hi.
I am able to authenticate on https://www.miele.com/developer/swagger-ui/swagger.html#/ with the creds I have defined in configuration.yaml, but the integration has stopped working. FYI, yesterday there was a firmware update for my dishwasher.
`

2022-08-29 12:10:09 2022-08-29 12:10:09.833 ERROR (MainThread) [homeassistant.setup] Error during setup of component miele Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component result = await task File "/config/custom_components/miele/init.py", line 152, in async_setup data_get_devices = await client.get_devices(lang) File "/config/custom_components/miele/miele_at_home.py", line 48, in get_devices home_devices = await self._get_devices_raw(lang) File "/config/custom_components/miele/miele_at_home.py", line 32, in _get_devices_raw if await self._session.refresh_token(self.hass): File "/config/custom_components/miele/miele_at_home.py", line 165, in refresh_token self._token = await hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/miele/miele_at_home.py", line 174, in sync_refresh_token return self._session.refresh_token( File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 452, in refresh_token self.token = self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 448, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters raise_from_error(params.get('error'), params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error raise cls(**kwargs) oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) Show context
   
   

`

@scaarup
Copy link
Author

scaarup commented Aug 31, 2022

I have tried to delete the integration completely, several times. I have generated new credentials also. I keep getting this error:
2022-08-31 08:52:50.799 ERROR (MainThread) [homeassistant.setup] Error during setup of component miele Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component result = await task File "/config/custom_components/miele/__init__.py", line 152, in async_setup data_get_devices = await client.get_devices(lang) File "/config/custom_components/miele/miele_at_home.py", line 48, in get_devices home_devices = await self._get_devices_raw(lang) File "/config/custom_components/miele/miele_at_home.py", line 32, in _get_devices_raw if await self._session.refresh_token(self.hass): File "/config/custom_components/miele/miele_at_home.py", line 165, in refresh_token self._token = await hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/miele/miele_at_home.py", line 174, in sync_refresh_token return self._session.refresh_token( File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 452, in refresh_token self.token = self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 448, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters raise_from_error(params.get('error'), params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error raise cls(**kwargs) oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant)

@CaptainPerox
Copy link

I am also getting the same error after not using home assistant for the last 2 months.
Here you can find the log:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 483, in request
url, headers, data = self._client.add_token(
File "/usr/local/lib/python3.10/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/setup.py", line 235, in _async_setup_component
result = await task
File "/config/custom_components/miele/init.py", line 152, in async_setup
data_get_devices = await client.get_devices(lang)
File "/config/custom_components/miele/miele_at_home.py", line 48, in get_devices
home_devices = await self._get_devices_raw(lang)
File "/config/custom_components/miele/miele_at_home.py", line 29, in _get_devices_raw
devices = await self.hass.async_add_executor_job(func)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 502, in request
token = self.refresh_token(
File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 452, in refresh_token
self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 448, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response
validate_token_parameters(params)
File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant)

@scaarup
Copy link
Author

scaarup commented Sep 12, 2022

I got this resolved.
What I eventually think did the trick, was this
cache_path: /config/miele_token
I was unable to locate the "default" token file, but I suspect there was some sort of invalid token file present on the system. (the cache_path must point to a file, not a directory. This is not mentioned in the documentation).

@xm4rcell0x
Copy link

I got this resolved. What I eventually think did the trick, was this cache_path: /config/miele_token I was unable to locate the "default" token file, but I suspect there was some sort of invalid token file present on the system. (the cache_path must point to a file, not a directory. This is not mentioned in the documentation).

thank you!

@NexusHero
Copy link

Where is the cache_path defined?

@scaarup
Copy link
Author

scaarup commented Oct 30, 2022

Where is the cache_path defined?

In your config - optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants