guerrerotook / securitas-direct-new-api

This repository contains the new securitas direct API that can be integrated in Home Assistant
Apache License 2.0
78 stars 30 forks source link

exceptions.SecuritasDirectError: Failed to decode authentication token None #206

Closed skamaleo closed 7 months ago

skamaleo commented 7 months ago

Is anyone experiencing the following issue with the token?

2024-02-13 08:57:34.600 DEBUG (MainThread) [custom_components.securitas.securitas_direct_new_api.apimanager] {"data":{"xSLoginToken":{"__typename":"XSLoginToken","res":"OK","msg":"Usuario validado correctamente","hash":null,"refreshToken":null,"legals":true,"changePassword":false,"needDeviceAuthorization":true,"mainUser":false}}} 2024-02-13 08:57:34.601 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry hauser for securitas Traceback (most recent call last): File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 328, in login token = jwt.decode( ^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jwt/api_jwt.py", line 210, in decode decoded = self.decode_complete( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jwt/api_jwt.py", line 151, in decode_complete decoded = api_jws.decode_complete( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jwt/api_jws.py", line 198, in decode_complete payload, signing_input, header, signature = self._load(jwt) ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jwt/api_jws.py", line 254, in _load raise DecodeError(f"Invalid token type. Token must be a {bytes}") jwt.exceptions.DecodeError: Invalid token type. Token must be a <class 'bytes'> The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/securitas/__init__.py", line 182, in async_setup_entry await client.login() File "/config/custom_components/securitas/__init__.py", line 356, in login await self.session.login() File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 334, in login raise SecuritasDirectError( custom_components.securitas.securitas_direct_new_api.exceptions.SecuritasDirectError: Failed to decode authentication token None

osmogar commented 7 months ago

I have the same problem since yesterday.

slywalker01 commented 7 months ago

Hi, exactly the same problem here

cantupaz commented 7 months ago

I'm seeing this too. I'll take a look.

cantupaz commented 7 months ago

I cannot seem to replicate this. I see this error in my logs starting 2024-02-12 15:41:41.834 (yesterday) and ending 2024-02-13 13:17:15.500 (today).

Right now everything seems to work fine with me (login, arming, disarming, getting status, etc). It could be a glitch on Securitas' side, but I don't really know.

If anyone is still seeing this, could you please update this issue?

osmogar commented 7 months ago

Yes, everything is working now too.

skamaleo commented 7 months ago

You are right, it is working again and probably a glitch as you say. Thank you for following up.