StsCredentials

StsCredentials

Implements the OAuth 2.0 token exchange based on https://tools.ietf.org/html/rfc8693

Constructor

new StsCredentials(options, clientAuthentication)

Initializes an STS credentials instance.

Parameters:
Name Type Description
options

The STS credentials instance options. Passing an tokenExchangeEndpoint directly is @DEPRECATED.

clientAuthentication

@DEPRECATED. Provide a StsCredentialsConstructionOptions object in the first parameter instead.

Methods

(async) exchangeToken(stsCredentialsOptions, additionalHeaders, options)

Exchanges the provided token for another type of token based on the rfc8693 spec.

Parameters:
Name Type Description
stsCredentialsOptions

The token exchange options used to populate the token exchange request.

additionalHeaders

Optional additional headers to pass along the request.

options encodeUriComponent(JSON.stringified(options))

Optional additional GCP-specific non-spec defined options to send with the request. Example: &options=$

Returns:
Type Description

A promise that resolves with the token exchange response containing the requested token and its expiration time.