flobz / psa_car_controller

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

3.4.0: Error: CredentialManager.generate_authorize_url() got an unexpected keyword argument 'code_challenge' #776

Closed RlfSt closed 5 months ago

RlfSt commented 5 months ago

Car: Opel Corsa-e (2022) App: PSA-Car-Controller 3.4.0 Env: Ubuntu 22.04.4 LTS (lxc-Container on Proxmox)

My configuration was broken on OAuth-Changes. I had do redo the authentication.

With v3.4.0 I followed the instructions and got the following error:

CredentialManager.generate_authorize_url() got an unexpected keyword argument 'code_challenge'

The error is reproducable with old otp.bin and without otp.bin.

Console output: root@psa-car-controller:~# psa-car-controller --web-conf -l 192.168.7.31 -p 5000 2024-02-25 07:22:28,692 :: INFO :: App version 3.4.0 2024-02-25 07:22:28,826 DEBUG Starting new HTTPS connection (1): idpcvs.opel.com:443 send: b'POST /am/oauth2/access_token HTTP/1.1\r\nHost: idpcvs.opel.com\r\nUser-Agent: python-requests/2.28.1\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: /\r\nConnection: keep-alive\r\nAuthorization: Basic xxx\r\nContent-Length: 96\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n' send: b'grant_type=refresh_token&scope=openid+profile&refresh_token=xxx-xxx-xxx-xxx-xxx' reply: 'HTTP/1.1 400 Bad Request\r\n' header: Strict-Transport-Security: max-age=16070400;includeSubDomains header: X-Frame-Options: SAMEORIGIN header: X-Content-Type-Options: nosniff header: X-XSS-Protection: 1; mode=block header: Cache-Control: no-store header: Date: Sun, 25 Feb 2024 06:22:29 GMT header: Accept-Ranges: bytes header: Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept header: Pragma: no-cache header: Content-Type: application/json header: Connection: close header: Set-Cookie: BIGipServerBE_IDPCLI_CVS_PROD_HTTPS_VIRTUAL.app~BE_IDPCLI_CVS_PROD_HTTPS_VIRTUAL_pool=26378250.47873.0000; path=/; Httponly; Secure header: Set-Cookie: PSACountry=DE; Domain=.opel.com; Path=/ header: Content-Encoding: gzip 2024-02-25 07:22:29,058 DEBUG https://idpcvs.opel.com:443 "POST /am/oauth2/access_token HTTP/1.1" 400 None 2024-02-25 07:22:29,060 :: ERROR :: Please reconnect by going to config web page 2024-02-25 07:22:29,060 :: INFO :: save config change 2024-02-25 07:22:29,062 :: WARNING :: Can't get language 2024-02-25 07:22:29,188 :: INFO :: NumExpr defaulting to 1 threads. 2024-02-25 07:22:29,509 :: INFO :: update_data 2024-02-25 07:22:29,513 :: INFO :: WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.

what command did you use /usr/bin/python3 /usr/local/bin/psa-car-controller --web-conf -l 192.168.7.31 -p 5000

when the bug append ? After hitting "Submit" in the web-conf-page

Does it persist after restarting the program? Yes.

Does it persist after recreate config by going to http://server_address:port/config? Yes.

SabatoArdolino commented 5 months ago

in HA configuration How do you connect in CLI ? I've the same problem

flobz commented 5 months ago

please upgrade oauth2-client >= 1.3.0 pip3 install -U 'oauth2-client>=1.3.0'

RlfSt commented 5 months ago

please upgrade oauth2-client >= 1.3.0 pip3 install -U 'oauth2-client>=1.3.0'

Thank you - that did the trick!

SabatoArdolino commented 5 months ago

I try but

error: externally-managed-environment

× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

where can I start the command ?