Skip to content

Commit

Permalink
add fallback for when cache expires at is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalmaceda committed Oct 30, 2020
1 parent b1901bb commit 9ab34d8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,14 @@ public boolean hasValidCredentials() {
String refreshToken = storage.retrieveString(KEY_REFRESH_TOKEN);
String idToken = storage.retrieveString(KEY_ID_TOKEN);
Long expiresAt = storage.retrieveLong(KEY_EXPIRES_AT);
Long cacheExpiresAt = storage.retrieveLong(KEY_CACHE_EXPIRES_AT);
if (cacheExpiresAt == null) {
cacheExpiresAt = expiresAt;
}

return !(isEmpty(accessToken) && isEmpty(idToken) ||
expiresAt == null ||
expiresAt <= getCurrentTimeInMillis() && refreshToken == null);
cacheExpiresAt == null ||
hasExpired(cacheExpiresAt) && refreshToken == null);
}

/**
Expand Down

0 comments on commit 9ab34d8

Please sign in to comment.