From d0958216ed188acb302547b24964087406402769 Mon Sep 17 00:00:00 2001 From: Ayush Walekar Date: Thu, 25 May 2023 12:17:51 +0530 Subject: [PATCH] fix: IdTokenClient expiry_date check to respect eagerRefreshThresholdMillis of parent class `OAuth2Client` --- src/auth/idtokenclient.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/auth/idtokenclient.ts b/src/auth/idtokenclient.ts index e123be29..38a72278 100644 --- a/src/auth/idtokenclient.ts +++ b/src/auth/idtokenclient.ts @@ -52,7 +52,8 @@ export class IdTokenClient extends OAuth2Client { ): Promise { if ( !this.credentials.id_token || - (this.credentials.expiry_date || 0) < Date.now() + !this.credentials.expiry_date || + this.isTokenExpiring() ) { const idToken = await this.idTokenProvider.fetchIdToken( this.targetAudience