mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Have some overlap in token expiry to prevent unauthorized issues
This commit is contained in:
parent
03c7fbe527
commit
365f67cbf8
1 changed files with 1 additions and 1 deletions
|
|
@ -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.
|
# 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) \
|
received_at = datetime.strptime(self._auth_data.received_at, TOKEN_TIMESTAMP_FORMAT) \
|
||||||
if self._auth_data.received_at else datetime(2000, 1, 1)
|
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:
|
if datetime.now() > expiry_date:
|
||||||
self.refreshAccessToken()
|
self.refreshAccessToken()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue