Closed greenscientist closed 5 months ago
In checkValidLogin, we don't actually validate that the Token is valid. The Transition class constructor does not check it.
def checkValidLogin(self):
"""Check if there is a login token in the settings"""
token = self.settings.value("token")
if token:
self.transition_instance = Transition(self.settings.value("url"), None, None, self.settings.value("token"))
return True
return False
(C'est tangentiel, mais on manque de catch d'exception un peu partout :) )
iirc Je pensais que c'était la lib qui, si le token est expiré, refaisait une requête pour un nouveau? (qu'on ne catch probablement pas dans Qgis, de sorte qu'on utilise quand même l'ancien?)
La lib ne fait pas ça. Peut-etre qu'une version antérieur le faisait.
I'm getting a stack trace, from what I understand is an expired token:
2024-05-27T15:51:21 WARNING Traceback (most recent call last): File "/home/scientist/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Transition-QGIS/transition_qgis.py", line 272, in show_dockwidget self.scenarios = self.transition_instance.get_scenarios() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/scientist/.local/lib/python3.11/site-packages/pyTransition/transition.py", line 168, in get_scenarios response.raise_for_status() File "/usr/lib/python3/dist-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://chaire.transition.city/api/v1/scenarios