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

Token is not yet valid #260

Closed
Flo2830 opened this issue Mar 2, 2024 · 3 comments
Closed

Token is not yet valid #260

Flo2830 opened this issue Mar 2, 2024 · 3 comments

Comments

@Flo2830
Copy link

Flo2830 commented Mar 2, 2024

It has recently become impossible to log in. Uninstalling and reinstalling the integration but no change:

Version: 0.9.2

Logger: custom_components.emporia_vue.config_flow
Source: custom_components/emporia_vue/config_flow.py:76
Integration: emporia_vue (documentation, issues)
First occurred: 18:32:07 (1 occurrences)
Last logged: 18:32:07

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/emporia_vue/config_flow.py", line 76, in async_step_user
info = await validate_input(self.hass, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/emporia_vue/config_flow.py", line 47, in validate_input
if not await hub.authenticate(data[CONF_EMAIL], data[CONF_PASSWORD]):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/emporia_vue/config_flow.py", line 37, in authenticate
result = await loop.run_in_executor(None, self.vue.login, username, password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyemvue/pyemvue.py", line 276, in login
self.auth = Auth(
^^^^^
File "/usr/local/lib/python3.12/site-packages/pyemvue/auth.py", line 49, in init
self.tokens = self.refresh_tokens()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyemvue/auth.py", line 53, in refresh_tokens
self.cognito.renew_access_token()
File "/usr/local/lib/python3.12/site-packages/pycognito/init.py", line 695, in renew_access_token
self._set_tokens(refresh_response)
File "/usr/local/lib/python3.12/site-packages/pycognito/init.py", line 767, in _set_tokens
self.verify_token(
File "/usr/local/lib/python3.12/site-packages/pycognito/init.py", line 266, in verify_token
raise TokenVerificationException(
pycognito.exceptions.TokenVerificationException: Your 'access_token' token could not be verified (The token is not yet valid (iat))

@magico13
Copy link
Owner

magico13 commented Mar 2, 2024

The change to pyJWT for token validation within pycognito has made the clock requirements more stringent and I haven't found a way to loosen them. The short of it is that your server time is likely a few seconds behind reality, force an NTP sync and then try again.

@Flo2830
Copy link
Author

Flo2830 commented Mar 2, 2024

thank you very much for this quick response, I'll check the NTP sync right away.

@Flo2830 Flo2830 closed this as completed Mar 3, 2024
@Flo2830
Copy link
Author

Flo2830 commented Mar 3, 2024

Force NTP sync by reboot VM Home assistant and connection success.
Thanks Magico13

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

2 participants