trocotronic/weconnect

Can't get past vwc.login() with shell_exec()

Closed this issue · 5 comments

There were some general problems with the WeConnect service around the 23th of juni, those were resolved. But since then I can't get past "vwc.login()" with shell_exec. It does force login when I use SSH. I get the following with the shell_exec:

[25/06/2023 14:54:52] [API::CRITICAL] Raising error msg: Error 400: voor login Traceback (most recent call last): File "/home/deb117581/vwconnectpython/kmlogscriptarray.py", line 9, in vwc.login() File "/home/deb117581/vwconnectpython/NativeAPI.py", line 289, in login if (not self.__check_tokens()): File "/home/deb117581/vwconnectpython/NativeAPI.py", line 261, in __check_tokens return self.__check_kit_tokens() and self.__check_oauth_tokens() File "/home/deb117581/vwconnectpython/NativeAPI.py", line 257, in __check_oauth_tokens return self.__check_oauth_scope('sc2:fal') and self.__check_oauth_scope('t2_v:cubic') File "/home/deb117581/vwconnectpython/NativeAPI.py", line 250, in __check_oauth_scope self.__refresh_oauth_scope(scope) File "/home/deb117581/vwconnectpython/NativeAPI.py", line 220, in __refresh_oauth_scope r = self.__get_url(self.OAUTH_URL, post=data, headers={'X-Client-Id':self.__x_client_id}) File "/home/deb117581/vwconnectpython/NativeAPI.py", line 130, in __get_url raise UrlError(r.status_code, msg, r) NativeAPI.UrlError: Error 400:

"vwo.login()" in with full debug gives:
[26/06/2023 19:38:04] [urllib3.connectionpool::DEBUG] Starting new HTTPS connection (1): tokenrefreshservice.apps.emea.vwapps.io:443 [26/06/2023 19:38:04] [urllib3.connectionpool::DEBUG] https://tokenrefreshservice.apps.emea.vwapps.io:443 "POST /refreshTokens HTTP/1.1" 200 4227 [26/06/2023 19:38:04] [urllib3.connectionpool::DEBUG] Starting new HTTPS connection (1): mbboauth-1d.prd.ece.vwg-connect.com:443 [26/06/2023 19:38:05] [urllib3.connectionpool::DEBUG] https://mbboauth-1d.prd.ece.vwg-connect.com:443 "POST /mbbcoauth/mobile/oauth2/v1/token HTTP/1.1" 200 None [26/06/2023 19:38:05] [API::ERROR] OAUTH t2_v:cubic not present. Cannot refresh [26/06/2023 19:38:05] [API::WARNING] Forcing login [26/06/2023 19:38:05] [urllib3.connectionpool::DEBUG] Starting new HTTPS connection (1): identity.vwgroup.io:443 [26/06/2023 19:38:05] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "GET /oidc/v1/authorize?prompt=login&state=R4SVLWRsh8smMrROVlMFiAzgFl7uopoRf-9pyjxiNL0&response_type=code+id_token+token&code_challenge_method=s256&scope=openid+profile+mbb+cars+birthdate+nickname+address+phone&code_challenge=ks7R9aFPs6dYCJRHwWLt1Ia0-bKAETRiOHJooM7_vLg&redirect_uri=carnet%3A%2F%2Fidentity-kit%2Flogin&client_id=9496332b-ea03-4091-a224-8c746b885068%40apps_vw-dilab_com&nonce=pjfYKpxQdKm19OWfE8Tqrf2RPleMtXstDKus57EsBfd HTTP/1.1" 302 0 [26/06/2023 19:38:05] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "GET /signin-service/v1/signin/9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com?relayState=4b4c1e51e66c0f1c01f7eea42db7e1dd61606143 HTTP/1.1" 200 60492 [26/06/2023 19:38:05] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "POST /signin-service/v1/9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com/login/identifier HTTP/1.1" 303 0 [26/06/2023 19:38:05] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "GET /signin-service/v1/9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com/login/authenticate?relayState=4b4c1e51e66c0f1c01f7eea42db7e1dd61606143 HTTP/1.1" 200 55301 [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "POST /signin-service/v1/9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com/login/authenticate HTTP/1.1" 302 0 [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "GET /oidc/v1/oauth/sso?clientId=9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com&relayState=4b4c1e51e66c0f1c01f7eea42db7e1dd61606143&userId=22062c8f-950e-44f7-918f-8afef799d190&HMAC=dac346a9a297f8a7e8617140238221c26870a67f96c6f42e400b07512299840f HTTP/1.1" 302 0 [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "GET /signin-service/v1/consent/users/22062c8f-950e-44f7-918f-8afef799d190/9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com?scopes=openid%20profile%20mbb%20cars%20birthdate%20nickname%20address%20phone&relayState=4b4c1e51e66c0f1c01f7eea42db7e1dd61606143&callback=https://identity.vwgroup.io/oidc/v1/oauth/client/callback&hmac=505bcb97a5400081b461759ded75231eb2eb9a2d0dbd4d80f015d66140cc9fe5 HTTP/1.1" 302 0 [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] https://identity.vwgroup.io:443 "GET /oidc/v1/oauth/client/callback/success?user_id=22062c8f-950e-44f7-918f-8afef799d190&client_id=9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com&scopes=openid%20profile%20mbb%20cars%20birthdate%20nickname%20address%20phone&consentedScopes=openid%20profile%20mbb%20cars%20birthdate%20nickname%20address%20phone&relayState=4b4c1e51e66c0f1c01f7eea42db7e1dd61606143&hmac=773c1416b19c4bc4e33a700a853b78ae35bbabee77f7c2be2258e23e63d7f844 HTTP/1.1" 302 0 [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] https://tokenrefreshservice.apps.emea.vwapps.io:443 "POST /exchangeAuthCode HTTP/1.1" 200 4299 [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] https://mbboauth-1d.prd.ece.vwg-connect.com:443 "POST /mbbcoauth/mobile/oauth2/v1/token HTTP/1.1" 200 None [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] https://mbboauth-1d.prd.ece.vwg-connect.com:443 "POST /mbbcoauth/mobile/oauth2/v1/token HTTP/1.1" 200 None [26/06/2023 19:38:06] [urllib3.connectionpool::DEBUG] Starting new HTTPS connection (1): customer-profile.apps.emea.vwapps.io:443 [26/06/2023 19:38:07] [urllib3.connectionpool::DEBUG] https://customer-profile.apps.emea.vwapps.io:443 "GET /v1/customers/22062c8f-950e-44f7-918f-8afef799d190/personalData HTTP/1.1" 200 820

I am not sure which role shell_exec plays in your code.

BTW try with:
1- Remove *.access and *.session files and try again.
2- Login to VW portal to accept any pending T&C.

I use shell_exec to get some data in an PHP environment.

1: I have deleted the access and session files multiple times when troubleshooting.
2. First thing I checked, but no terms or anything to accept. I changed the password en deleted all connected devices; only thing I haven't changed on the VW side is the S-pin.

I deleted everything I had used with this and reinstalled Python. And yet I still get:

[27/06/2023 16:39:18] [urllib3.connectionpool::DEBUG] Starting new HTTPS connection (1): mbboauth-1d.prd.ece.vwg-connect.com:443 [27/06/2023 16:39:18] [urllib3.connectionpool::DEBUG] https://mbboauth-1d.prd.ece.vwg-connect.com:443 "POST /mbbcoauth/mobile/oauth2/v1/token HTTP/1.1" 400 None [27/06/2023 16:39:18] [API::CRITICAL] Raising error msg: Error 400: print before vwc login Traceback (most recent call last): File "/home/deb117581/kmlogpython/kmlogscriptarray.py", line 9, in vwc.login() File "/home/deb117581/kmlogpython/NativeAPI.py", line 289, in login if (not self.__check_tokens()): File "/home/deb117581/kmlogpython/NativeAPI.py", line 261, in __check_tokens return self.__check_kit_tokens() and self.__check_oauth_tokens() File "/home/deb117581/kmlogpython/NativeAPI.py", line 257, in __check_oauth_tokens return self.__check_oauth_scope('sc2:fal') and self.__check_oauth_scope('t2_v:cubic') File "/home/deb117581/kmlogpython/NativeAPI.py", line 250, in __check_oauth_scope self.__refresh_oauth_scope(scope) File "/home/deb117581/kmlogpython/NativeAPI.py", line 220, in __refresh_oauth_scope r = self.__get_url(self.OAUTH_URL, post=data, headers={'X-Client-Id':self.__x_client_id}) File "/home/deb117581/kmlogpython/NativeAPI.py", line 130, in __get_url raise UrlError(r.status_code, msg, r) NativeAPI.UrlError: Error 400:

All that comes to mind is that the OAUTH_URL value has become false/was changed on the VW side.

But the log you posted at #17 (comment) is correct right?

That was what I was getting in the stderr . But I have figured it out. It was, let's say a bug, on my side. I needed to define the working directory. No clue why, didn't need to the last couple of weeks. Hosted servers...

It turns out my problems did not come from your project. Thx for the responses! *And the project itself off course.