Skip to content

Commit

Permalink
Fixed a bug with the token expiration.| #716
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Aug 25, 2020
1 parent b4d3649 commit 0dc0f50
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ class FlowcryptAccountAuthenticator(val context: Context) : AbstractAccountAuthe

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

if (authToken.isNullOrEmpty()) {
if (authToken.isNullOrEmpty() || isTokenExpired) {
val encryptedRefreshToken = accountManager.getUserData(account, KEY_REFRESH_TOKEN)
if (encryptedRefreshToken.isNullOrEmpty()) {
return Bundle().apply {
Expand Down

0 comments on commit 0dc0f50

Please sign in to comment.