Provides automatically renewed access tokens for a service account.
This is the main service-account credential for the SDK. It signs a short-lived assertion, exchanges it for an access token, keeps the access token in memory, and renews it before expiration.
Returns a JSON-safe value for logs.
Creates renewable service-account credentials.
serviceAccount can be a reader, a complete ServiceAccount, or a
service account ID. When it is an ID, privateKeyPem and publicKeyId
are required. Do not supply these two options for the other input forms.
Optionalopts: {OptionalinitialRetryTimeoutMs?: numberInitial renewal backoff, in milliseconds.
OptionallifetimeSafeFraction?: numberFraction of token lifetime to wait before proactive renewal.
Optionallogger?: LoggerOptional destination for diagnostic events.
OptionalmaxRetries?: numberMaximum total authentication attempts for one receiver. Defaults to 2.
OptionalmaxRetryTimeoutMs?: numberMaximum renewal backoff, in milliseconds.
Optionalmetrics?: AuthMetricsInputOptional authentication metrics destination.
OptionalprivateKeyPem?: stringPEM private key. Required only when serviceAccount is an ID string.
OptionalpublicKeyId?: stringRegistered public-key ID. Required only when serviceAccount is an ID string.
OptionalrefreshRequestTimeoutMs?: numberDefault token-exchange request budget, in milliseconds.
It applies to foreground and background renewal when the caller does not supply a synchronous override.
OptionalretryTimeoutExponent?: numberMultiplier for exponential renewal backoff.
Optionalsdk?: SDKInterface | Promise<SDKInterface> | nullSDK used for the token-exchange RPC.
Required for a prebuilt bearer. As an easier alternative, pass raw
service-account values to new SDK({ credentials: ... }).
Readonly$typeContains the fully qualified runtime type name.
Returns the provider name for authorization metrics.
Returns the stable credential name used by file-backed token caches.
Most bearers do not have a name. Wrappers can add one with NamedBearer.
Returns the wrapped bearer.
Returns a JSON-safe value for logs.
Stops owned background work and closes the wrapped bearer.
OptionalgraceMs: numberCreates a receiver that shares this bearer’s renewal state.
The bearer must have the exchange SDK supplied in its constructor options before the first token exchange. An SDK does not connect a prebuilt bearer.
Sets or clears the SDK used for token exchange.
Provides automatically renewed access tokens for a service account.
This is the main service-account credential for the SDK. It signs a short-lived assertion, exchanges it for an access token, keeps the access token in memory, and renews it before expiration.
Example: Use separate service-account fields
Close the SDK during shutdown. This stops the renewal timer.