Refresh tokens earlyier than their full lifetime

This commit is contained in:
norohind 2021-12-08 18:26:30 +03:00
parent 17efd41457
commit 6a09c5b260
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1

View File

@ -125,7 +125,9 @@ class CAPIAuthorizer:
msg['state'] = state
if int(time.time()) < int(row['timestamp_got_expires_in']) + int(row['expires_in']) and not force_refresh:
if int(time.time()) < int(row['timestamp_got_expires_in']) + int(row['expires_in'] - 400) and not force_refresh:
# current time < when we got token + token lifetime - 400, 400 is need just to refresh token on 400 secs
# earlier than lifetime stated by FDEV, for safe
msg['status'] = 'ok'
msg['description'] = "Didn't refresh since it isn't required"