Prevent token refresh loop

This commit is contained in:
M66B 2021-12-24 10:26:23 +01:00
parent 6b000d75ee
commit 3ceb1711cd
2 changed files with 4 additions and 2 deletions

View File

@ -136,7 +136,8 @@ public class ServiceAuthenticator extends Authenticator {
Log.e(ex);
}
if (expiration != null && expiration - keep_alive < new Date().getTime())
long slack = Math.min(keep_alive, 30 * 60 * 1000L);
if (expiration != null && expiration - slack < new Date().getTime())
throw new IllegalStateException(Log.TOKEN_REFRESH_REQUIRED);
}

View File

@ -2005,7 +2005,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
// Check token expiration
iservice.check();
if (!account.isTransient(this))
iservice.check();
// Sends store NOOP
if (EmailService.SEPARATE_STORE_CONNECTION) {