trocotronic / weconnect

API to interact with Volkswagen's service We Connect (formerly CarNet)
Open Data Commons Open Database License v1.0
83 stars 17 forks source link

Login after token refresh times out #19

Open signag opened 1 year ago

signag commented 1 year ago

I have an issue with login after tokens have been refreshed. This one seems to be different from #16.

From my main program, I cyclically call _getvsr from nativeAPI.py every 15 minutes. This works fine for 5 cycles (about 1 hour) using the cached session data, In the 6th cycle (see attached trace file starting at line 260), tokens are found to be expired and a new login is made. However, _geturl, called from _forcelogin, times out after ~15 minutes with ConnectionError 'Remote end closed connection without response'

The attached trace file covers the entire test run and has the exception output included at the end.

Thanks for support monitorVW_02.log

trocotronic commented 1 year ago

Try replacing line 250 of NativeAPI

            if (scope in self.__oauth and 'refresh_token' in self.__oauth[scope]):

By

            if (scope in self.__oauth and 'refresh_token' in self.__oauth['sc2:fal']):

It’s something wrong with cubic token.

signag commented 1 year ago

Thanks for the quick response.

I tried the suggested modification but I am running into the same issue.

Here is the modification: image

Note that the difference in line numbers in my version is due to minor modifications which do not have any influence on functionality:

I have attached the new trace file. What is different now is that tokens are expired already in the first cycle (starts at line 26), because I had started with existing weconnectAPI.access and weconnectAPI.session. In this initial cycle, the forced login works fine. However, in the 6th cycle (starting at line 266), the login has a timeout again. monitorVW_07.log

trocotronic commented 1 year ago

Which is the current status of this issue? Still persists?

signag commented 1 year ago

Issue still persists