flobz / psa_car_controller

Control psa car with connected_car v4 API.
GNU General Public License v3.0
438 stars 233 forks source link

Possibly changed access token json response from `accessToken` to `token` #994

Open tuomari opened 1 week ago

tuomari commented 1 week ago

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 -