ExternalAccountAuthorizedUserClient

ExternalAccountAuthorizedUserClient

External Account Authorized User Client. This is used for OAuth2 credentials sourced using external identities through Workforce Identity Federation. Obtaining the initial access and refresh token can be done through the Google Cloud CLI.

Constructor

new ExternalAccountAuthorizedUserClient(options)

Instantiates an ExternalAccountAuthorizedUserClient instances using the provided JSON object loaded from a credentials files. An error is throws if the credential is not valid.

Parameters:
Name Type Description
options

The external account authorized user option object typically from the external accoutn authorized user JSON credential file.

Methods

isExpired(credentials)

Returns whether the provided credentials are expired or not. If there is no expiry time, assumes the token is not expired or expiring.

Parameters:
Name Type Description
credentials

The credentials to check for expiration.

Returns:
Type Description

Whether the credentials are expired or not.

(async) refreshAccessTokenAsync()

Forces token refresh, even if unexpired tokens are currently cached.

Returns:
Type Description

A promise that resolves with the refreshed credential.

(async) requestAsync(opts, reAuthRetried)

Authenticates the provided HTTP request, processes it and resolves with the returned response.

Parameters:
Name Type Default Description
opts

The HTTP request options.

reAuthRetried false

Whether the current attempt is a retry after a failed attempt due to an auth failure.

Returns:
Type Description

A promise that resolves with the successful response.