Skip to content

Commit a7a8d7a

Browse files
authored
feat: Modify the refresh window to match go/async-token-refresh. Serverless tokens are cached until 4 minutes before expiration, so 4 minutes is the ideal refresh window. (#1352)
* feat: Modify the refresh window to match go/async-token-refresh. Serverless tokens are cached until 4 minutes before expiration, so 4 minutes is the ideal refresh window. * Tweak time to 3 minutes and 45 seconds, giving the MDS a 15 second window to refresh. * Update both expiration margin and refresh margin.
1 parent 5226e76 commit a7a8d7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
public class OAuth2Credentials extends Credentials {
6969

7070
private static final long serialVersionUID = 4556936364828217687L;
71-
static final Duration DEFAULT_EXPIRATION_MARGIN = Duration.ofMinutes(5);
72-
static final Duration DEFAULT_REFRESH_MARGIN = Duration.ofMinutes(6);
71+
static final Duration DEFAULT_EXPIRATION_MARGIN = Duration.ofMinutes(3);
72+
static final Duration DEFAULT_REFRESH_MARGIN = Duration.ofMinutes(3).plusSeconds(45);
7373
private static final ImmutableMap<String, List<String>> EMPTY_EXTRA_HEADERS = ImmutableMap.of();
7474

7575
@VisibleForTesting private final Duration expirationMargin;

0 commit comments

Comments
 (0)