mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 10:17:18 +00:00
Refresh tokens 5 minutes earlier
This commit is contained in:
parent
2bbeba77ed
commit
45744de245
1 changed files with 2 additions and 1 deletions
|
@ -65,6 +65,7 @@ public class ServiceAuthenticator extends Authenticator {
|
||||||
static final int AUTH_TYPE_OAUTH = 3;
|
static final int AUTH_TYPE_OAUTH = 3;
|
||||||
static final int AUTH_TYPE_GRAPH = 4;
|
static final int AUTH_TYPE_GRAPH = 4;
|
||||||
|
|
||||||
|
static final long ADVANCE_REFRESH_TIME = 5 * 60 * 1000L;
|
||||||
static final long MIN_REFRESH_INTERVAL = 15 * 60 * 1000L;
|
static final long MIN_REFRESH_INTERVAL = 15 * 60 * 1000L;
|
||||||
static final long MIN_FORCE_REFRESH_INTERVAL = 15 * 60 * 1000L;
|
static final long MIN_FORCE_REFRESH_INTERVAL = 15 * 60 * 1000L;
|
||||||
static final int MAX_TOKEN_WAIT = 90; // seconds
|
static final int MAX_TOKEN_WAIT = 90; // seconds
|
||||||
|
@ -161,7 +162,7 @@ public class ServiceAuthenticator extends Authenticator {
|
||||||
try {
|
try {
|
||||||
long now = new Date().getTime();
|
long now = new Date().getTime();
|
||||||
Long expiration = authState.getAccessTokenExpirationTime();
|
Long expiration = authState.getAccessTokenExpirationTime();
|
||||||
boolean needsRefresh = (expiration != null && expiration < now);
|
boolean needsRefresh = (expiration != null && expiration - ADVANCE_REFRESH_TIME < now);
|
||||||
|
|
||||||
if (!needsRefresh && forceRefresh &&
|
if (!needsRefresh && forceRefresh &&
|
||||||
expiration != null &&
|
expiration != null &&
|
||||||
|
|
Loading…
Reference in a new issue