Skip to content

Commit 0dc0f50

Browse files
committed
Fixed a bug with the token expiration.| #716
1 parent b4d3649 commit 0dc0f50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

FlowCrypt/src/main/java/com/flowcrypt/email/accounts/FlowcryptAccountAuthenticator.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ class FlowcryptAccountAuthenticator(val context: Context) : AbstractAccountAuthe
5757

5858
val expireAtInMillis = accountManager.getUserData(account, KEY_EXPIRES_AT)?.toLongOrNull() ?: 0
5959
var authToken = accountManager.peekAuthToken(account, authTokenType)
60+
val isTokenExpired = System.currentTimeMillis() - expireAtInMillis > 0
6061

61-
if (authToken.isNullOrEmpty()) {
62+
if (authToken.isNullOrEmpty() || isTokenExpired) {
6263
val encryptedRefreshToken = accountManager.getUserData(account, KEY_REFRESH_TOKEN)
6364
if (encryptedRefreshToken.isNullOrEmpty()) {
6465
return Bundle().apply {

0 commit comments

Comments
 (0)