Skip to content

Commit

Permalink
Try for more meaningful name than "now"
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSimmons committed Sep 18, 2023
1 parent 7d0749b commit f16ccf6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/gettyimages/api/Credentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ public static Credentials GetInstance(String apiKey, String apiSecret, String us
}

public Token GetAccessToken() throws SdkException {
Calendar now = Calendar.getInstance();
now.add(Calendar.MINUTE, 5);
Calendar expirationCushion = Calendar.getInstance();
expirationCushion.add(Calendar.MINUTE, 5);

if (CredentialType != CredentialType.ClientCredentials && CredentialType != CredentialType.ResourceOwner && CredentialType != CredentialType.RefreshToken
||
(accessToken != null && accessToken.getExpiration().compareTo(now.getTime()) >= 0)) {
(accessToken != null && accessToken.getExpiration().compareTo(expirationCushion.getTime()) >= 0)) {
return accessToken;
}

Expand Down

0 comments on commit f16ccf6

Please sign in to comment.