1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Check token expiration

This commit is contained in:
M66B 2022-07-21 14:45:47 +02:00
parent 549a6f1fcd
commit 3b82117c6a

View file

@ -2241,6 +2241,17 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
throw new StoreClosedException(iservice.getStore(), "Unrecoverable", cause);
}
// Check token expiration
if (!account.isTransient(this)) {
Long expirationTime = iservice.getAccessTokenExpirationTime();
if (expirationTime != null && expirationTime < new Date().getTime()) {
EntityLog.log(this, EntityLog.Type.Debug, "Token" +
" expired=" + new Date(expirationTime) +
" user=" + account.provider + ":" + account.user);
throw new IllegalStateException(Log.TOKEN_REFRESH_REQUIRED);
}
}
// Sends store NOOP
if (EmailService.SEPARATE_STORE_CONNECTION) {
EntityLog.log(this, EntityLog.Type.Account, account,