psa_car_controller
psa_car_controller copied to clipboard
Possibly changed access token json response from `accessToken` to `token`
Describe the bug When trying to configure the application, I receive an error:
Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 59, in __init__
self.token = res.json()["accessToken"]
KeyError: 'accessToken'
HOST_BRANDID : https://id-dcr.peugeot.com/mobile-services sitecode: AP_FI_ESP{"returnCode":"OK","token":"<clipped-valid-access-token>"}
So it seems that I receive a valid access token, but the key has changed from accessToken to token
Full error log from console:
hassio-peugeot_psacc-1 | 2024-11-14 19:30:46,575 :: ERROR :: Traceback (most recent call last):
hassio-peugeot_psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 59, in __init__
hassio-peugeot_psacc-1 | self.token = res.json()["accessToken"]
hassio-peugeot_psacc-1 | KeyError: 'accessToken'
hassio-peugeot_psacc-1 |
hassio-peugeot_psacc-1 | HOST_BRANDID : https://id-dcr.peugeot.com/mobile-services sitecode: AP_FI_ESP{"returnCode":"OK","token":"<clipped-valid-access-token>"}
hassio-peugeot_psacc-1 | 2024-11-14 19:30:46,576 :: ERROR :: Traceback (most recent call last):
hassio-peugeot_psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 59, in __init__
hassio-peugeot_psacc-1 | self.token = res.json()["accessToken"]
hassio-peugeot_psacc-1 | KeyError: 'accessToken'
hassio-peugeot_psacc-1 |
hassio-peugeot_psacc-1 | HOST_BRANDID : https://id-dcr.peugeot.com/mobile-services sitecode: AP_FI_ESP{"returnCode":"OK","token":"<clipped-valid-access-token>"}
hassio-peugeot_psacc-1 | Traceback (most recent call last):
hassio-peugeot_psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 59, in __init__
hassio-peugeot_psacc-1 | self.token = res.json()["accessToken"]
hassio-peugeot_psacc-1 | KeyError: 'accessToken'
hassio-peugeot_psacc-1 |
hassio-peugeot_psacc-1 | The above exception was the direct cause of the following exception:
hassio-peugeot_psacc-1 |
hassio-peugeot_psacc-1 | Traceback (most recent call last):
hassio-peugeot_psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/config_views.py", line 137, in connectPSA
hassio-peugeot_psacc-1 | INITIAL_SETUP = InitialSetup(app_name, email, password, countrycode)
hassio-peugeot_psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 68, in __init__
hassio-peugeot_psacc-1 | raise ConnectionError(msg) from ex
hassio-peugeot_psacc-1 | ConnectionError: Traceback (most recent call last):
hassio-peugeot_psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 59, in __init__
hassio-peugeot_psacc-1 | self.token = res.json()["accessToken"]
hassio-peugeot_psacc-1 | KeyError: 'accessToken'
hassio-peugeot_psacc-1 |
hassio-peugeot_psacc-1 | HOST_BRANDID : https://id-dcr.peugeot.com/mobile-services sitecode: AP_FI_ESP{"returnCode":"OK","token":"<clipped-valid-access-token>"}
hassio-peugeot_psacc-1 | 2024-11-14 19:30:46,582 :: INFO :: 192.168.100.67 - - [14/Nov/2024 19:30:46] "POST /_dash-update-component HTTP/1.1" 200 -
I have the same problem. Did you find a workaround?
I tried changing "accessToken" with "token" and it didn't work because the second time I received "accessToken". Then reverted and tried again and it worked. So, probably the workaround is to just try to login again.