Add eagerRefreshThresholdMillis
parameter to the IdTokenClient
to prevent getting invalid token on getRequestHeaders
#1358
Labels
next major: breaking change
this is a change that we should wait to bundle into the next major version
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Hi,
Is your feature request related to a problem?.
Yes, we are using the library to make http calls to a GCP Cloud Run service with the
IdTokenClient
. But sometimes, we have a401
because the token is expired.After investigation, those
401
occure when the token is about to expire. The root cause is a clock delay on the system calling system.Describe the solution you'd like
We want to be hable to pass a parameter, like
eagerRefreshThresholdMillis
inOAuth2Client
, to force refresh token x millisecond before the end.Describe alternatives you've considered
To mitigate the issue, we have overrided the
getRequestMetadataAsync
inIdTokenClient
to take into account a customeagerRefreshThresholdMillis
at this line .Additional context
We create the client with
googleAuth.getIdTokenClient(targetAudience)
and get the token (auth headers) withgetRequestHeaders
The text was updated successfully, but these errors were encountered: