Просмотр исходного кода

Have some overlap in token expiry to prevent unauthorized issues

ChrisTerBeke 6 лет назад
Родитель
Сommit
365f67cbf8
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      cura/OAuth2/AuthorizationService.py

+ 1 - 1
cura/OAuth2/AuthorizationService.py

@@ -110,7 +110,7 @@ class AuthorizationService:
         # We have a fallback on a date far in the past for currently stored auth data in cura.cfg.
         received_at = datetime.strptime(self._auth_data.received_at, TOKEN_TIMESTAMP_FORMAT) \
             if self._auth_data.received_at else datetime(2000, 1, 1)
-        expiry_date = received_at + timedelta(seconds = float(self._auth_data.expires_in or 0))
+        expiry_date = received_at + timedelta(seconds = float(self._auth_data.expires_in) - 60 or 0)
         if datetime.now() > expiry_date:
             self.refreshAccessToken()