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:
parent
549a6f1fcd
commit
3b82117c6a
1 changed files with 11 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue