Skip to content

Commit

Permalink
Merge pull request #875 from AzureAD/avdunn/expire-buffer-fix
Browse files Browse the repository at this point in the history
Correctly set buffer for expired tokens
  • Loading branch information
Avery-Dunn authored Oct 27, 2024
2 parents ff44d4a + 412c842 commit c7ed174
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private boolean shouldRefresh(SilentParameters parameters, AuthenticationResult
long currTimeStampSec = new Date().getTime() / 1000;

//If the access token is expired or within 5 minutes of becoming expired, refresh it
if (!StringHelper.isBlank(cachedResult.accessToken()) && cachedResult.expiresOn() < (currTimeStampSec - ACCESS_TOKEN_EXPIRE_BUFFER_IN_SEC)) {
if (!StringHelper.isBlank(cachedResult.accessToken()) && cachedResult.expiresOn() < (currTimeStampSec + ACCESS_TOKEN_EXPIRE_BUFFER_IN_SEC)) {
setCacheTelemetry(CacheTelemetry.REFRESH_ACCESS_TOKEN_EXPIRED.telemetryValue);
log.debug("Refreshing access token because it is expired.");
return true;
Expand Down

0 comments on commit c7ed174

Please sign in to comment.