VWsFriend icon indicating copy to clipboard operation
VWsFriend copied to clipboard

Insecure Transport for OAuth2 Authentication

Open motorto opened this issue 1 year ago • 17 comments

2024-11-30T16:02:48+0000:INFO:session_manager:Could not use token from file /tmp/weconnect.token ([Errno 2] No such file or directory: '/tmp/weconnect.token')
Traceback (most recent call last):
  File "/opt/venv/bin/vwsfriend", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/vwsfriend/vwsfriend_base.py", line 329, in main
    weConnect = weconnect.WeConnect(username=weConnectUsername, password=weConnectPassword, spin=weConnectSpin, tokenfile=tokenfile,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/weconnect.py", line 114, in __init__
    self.__session.login()
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 76, in login
    response = self.doWebAuth(authorizationUrl)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 253, in doWebAuth
    afterLoginResponse = self.get(afterLoginUrl, allow_redirects=False, access_type=AccessType.NONE)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 69, in request
    return super(WeConnectSession, self).request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/openid_session.py", line 188, in request
    raise InsecureTransportError()
oauthlib.oauth2.rfc6749.errors.InsecureTransportError: (insecure_transport) OAuth 2 MUST utilize https.

motorto avatar Nov 30 '24 16:11 motorto

Same as #701

Bitte einmal in der App ausloggen und wieder einloggen und die neuen Terms akzeptieren.

thgau avatar Nov 30 '24 17:11 thgau

Same as #701

Bitte einmal in der App ausloggen und wieder einloggen und die neuen Terms akzeptieren.

This work for me. Thanks!

kennyob avatar Nov 30 '24 17:11 kennyob

Please, could you elaborate a bit and if possible answer in english too. I have the same issue and I did not quite catch the comment.

kotipalvelu avatar Nov 30 '24 21:11 kotipalvelu

Please logout and in in the Volkswagen app to accept the terms and conditions again.

tillsteinbach avatar Nov 30 '24 22:11 tillsteinbach

Even after accept of new terms on login, still this error message.

AndreasNoj avatar Dec 06 '24 07:12 AndreasNoj

Restarting the container doesn't help ?

On Fri, Dec 6, 2024, 07:26 AndreasNoj @.***> wrote:

Even after accept of new terms on login, still this error message.

— Reply to this email directly, view it on GitHub https://github.com/tillsteinbach/VWsFriend/issues/702#issuecomment-2522316098, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRTQPKNF5K54LFYJVBGVEL2EFGS7AVCNFSM6AAAAABSYVGRZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRSGMYTMMBZHA . You are receiving this because you authored the thread.Message ID: @.***>

motorto avatar Dec 06 '24 09:12 motorto

No same issue - when loggin in on the app and on VW website, now always get the screen where I have to accept the "Term and Privacy" Screenshot 2024-12-06 102839

AndreasNoj avatar Dec 06 '24 09:12 AndreasNoj

Same problem. When testing 'weconnect-cli' I get notification:

CRITICAL:There was a problem when authenticating with WeConnect: It seems like you need to accept the terms and conditions for the Volkswagen service. Try to visit the URL "https://identity.vwgroup.io//signin-service/v1/a24fba63-34b3-4d43-b181-942111e6bda8@apps_vw-dilab_com/terms-and-conditions?relayState=4ddd3771922514412406b4ccb17f29df2580cb68&canChangeCountryOfResidence=false&userId=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx&updated=dataprivacy" or log into the Volkswagen smartphone app

This URL gives "Something went wrong" error, so I guess there are some issues on VW side.

Rixu101 avatar Dec 07 '24 11:12 Rixu101

Same issue here. The website and app always ask me to accept the "Terms and Privacy" during the login process, even though I clicked "Accept" the last time I logged in.

image

flav-allaz avatar Dec 07 '24 18:12 flav-allaz

I was able to fix it by doing this trick on the VW website:

  1. Change my country to Germany
  2. Log out, then log in again and accept the "Terms and Privacy" (at this point "weconnect-cli" started working again)
  3. Changed my country back to Switzerland
  4. :partying_face: :tada:

flav-allaz avatar Dec 07 '24 18:12 flav-allaz

I'm not able to change to Germany - the option is greyed out and only UK is available.

Unable to start my vwsfriend container as a result (or at least it starts, but never presents a page)

Docker compose logs:

vwsfriend-vwsfriend-1   | 2024-12-17T11:14:10+0000:INFO:vwsfriend_base:vwsfriend 0.24.7 (using WeConnect-python 0.60.5, WeConnect-mqtt 0.49.2)
vwsfriend-vwsfriend-1   | 2024-12-17T11:14:10+0000:INFO:session_manager:Could not use token from file /tmp/weconnect.token ([Errno 2] No such file or directory: '/tmp/weconnect.token')
vwsfriend-vwsfriend-1   | 2024-12-17T11:14:11+0000:CRITICAL:vwsfriend_base:There was a problem when authenticating with WeConnect: Login throttled, probably too many wrong logins. You have to wait some minutes until a new login attempt is possible

Container logs:

Traceback (most recent call last):
  File "/opt/venv/bin/vwsfriend", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/vwsfriend/vwsfriend_base.py", line 329, in main
    weConnect = weconnect.WeConnect(username=weConnectUsername, password=weConnectPassword, spin=weConnectSpin, tokenfile=tokenfile,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/weconnect.py", line 114, in __init__
    self.__session.login()
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 76, in login
    response = self.doWebAuth(authorizationUrl)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 253, in doWebAuth
    afterLoginResponse = self.get(afterLoginUrl, allow_redirects=False, access_type=AccessType.NONE)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 69, in request
    return super(WeConnectSession, self).request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/openid_session.py", line 188, in request
    raise InsecureTransportError()
oauthlib.oauth2.rfc6749.errors.InsecureTransportError: (insecure_transport) OAuth 2 MUST utilize https.

garethbradley avatar Dec 17 '24 11:12 garethbradley

I was able to fix it with the above information. Login to the website, and in your profile select Germany as the country. This is located almost at the bottom, i.e. do not change the country in your address this does not work.

chaudron avatar Dec 18 '24 19:12 chaudron

I was able to setup VWsFriend setting the country and region to "Germany". Logout of the VW website, log on again and confirm the german terms and condition image

martintamke avatar Jan 06 '25 07:01 martintamke

Unfortunately, even after changing the country (not the adress) and accepting the terms in the app, I am unable to start the container with the OAuth2 error.

Any pointers?

DieterKoblenz avatar Jan 09 '25 19:01 DieterKoblenz

Can you post the response that you receive in the Terminal here? That would help to see whether it is the same error others received.

martintamke avatar Jan 10 '25 15:01 martintamke

Hello,

since yesterday I also have the same problem. It seems that vwsfreind can't authorize with WeConnect. I already logged out and in in the Volkswagen app. I also tried on the Webpage https://vwid.vwgroup.io/. I even changed the "country and region" to Albania and back to Germany, but there were no new "Terms and Privacy" notes for acceptance.

Maybe anybody could help?

Here is my docker error log:

vwsfriend-1   | 2025-11-25T11:50:39+0000:INFO:vwsfriend_base:vwsfriend 0.24.7 (using WeConnect-python 0.60.5, WeConnect-mqtt 0.49.2)
vwsfriend-1   | 2025-11-25T11:50:39+0000:INFO:session_manager:Could not use token from file /tmp/weconnect.token ([Errno 2] No such file or directory: '/tmp/weconnect.token')
vwsfriend-1   | Traceback (most recent call last):
vwsfriend-1   |   File "/opt/venv/bin/vwsfriend", line 8, in <module>
vwsfriend-1   |     sys.exit(main())
vwsfriend-1   |              ^^^^^^
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/vwsfriend/vwsfriend_base.py", line 329, in main
vwsfriend-1   |     weConnect = weconnect.WeConnect(username=weConnectUsername, password=weConnectPassword, spin=weConnectSpin, tokenfile=tokenfile,
vwsfriend-1   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/weconnect/weconnect.py", line 114, in __init__
vwsfriend-1   |     self.__session.login()
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 76, in login
vwsfriend-1   |     response = self.doWebAuth(authorizationUrl)
vwsfriend-1   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/weconnect/auth/we_connect_session.py", line 123, in doWebAuth
vwsfriend-1   |     loginFormResponse: requests.Response = websession.get(authorizationUrl, allow_redirects=False)
vwsfriend-1   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
vwsfriend-1   |     return self.request("GET", url, **kwargs)
vwsfriend-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/requests/sessions.py", line 575, in request
vwsfriend-1   |     prep = self.prepare_request(req)
vwsfriend-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/requests/sessions.py", line 484, in prepare_request
vwsfriend-1   |     p.prepare(
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/requests/models.py", line 367, in prepare
vwsfriend-1   |     self.prepare_url(url, params)
vwsfriend-1   |   File "/opt/venv/lib/python3.12/site-packages/requests/models.py", line 438, in prepare_url
vwsfriend-1   |     raise MissingSchema(
vwsfriend-1   | requests.exceptions.MissingSchema: Invalid URL '/u/login?state=hKFo2SB6MkkyMmJBUW02bEJHQzhhYjduSF9UTFBEYzA2a18yd6Fur3VuaXZlcnNhbC1sb2dpbqN0aWTZIGtmSndRNEpzMG9JVjVQZTdPQXpFYTd2T3Q4R3Y1RHppo2NpZNk2YTI0ZmJhNjMtMzRiMy00ZDQzLWIxODEtOTQyMTExZTZiZGE4QGFwcHNfdnctZGlsYWJfY29': No scheme supplied. Perhaps you meant https:///u/login?state=hKFo2SB6MkkyMmJBUW02bEJHQzhhYjduSF9UTFBEYzA2a18yd6Fur3VuaXZlcnNhbC1sb2dpbqN0aWTZIGtmSndRNEpzMG9JVjVQZTdPQXpFYTd2T3Q4R3Y1RHppo2NpZNk2YTI0ZmJhNjMtMzRiMy00ZDQzLWIxODEtOTQyMTExZTZiZGE4QGFwcHNfdnctZGlsYWJfY29?

tillburner avatar Nov 25 '25 12:11 tillburner

@tillburner most likely your issue is #752

ualex73 avatar Nov 30 '25 14:11 ualex73