The main authentication interface. It takes an optional url which when present is the endpoint> being accessed, and returns a Promise which resolves with authorization header fields.
The result has the form: { Authorization: 'Bearer <access_token_value>' }
Forces token refresh, even if unexpired tokens are currently cached. GCP access tokens are retrieved from authclient object/source credential. Thenm GCP access tokens are exchanged for downscoped access tokens via the token exchange endpoint. A promise that resolves with the fresh downscoped access token.
Returns
Type
Description
Promise<CredentialsWithResponse>
request(opts)
request<T>(opts:GaxiosOptions):GaxiosPromise<T>;
Provides a request implementation with OAuth 2.0 flow. In cases of HTTP 401 and 403 responses, it automatically asks for a new access token and replays the unsuccessful request.
Provides a mechanism to inject Downscoped access tokens directly. When the provided credential expires, a new credential, using the external account options are retrieved. Notice DownscopedClient is the broker class mainly used for generate downscoped access tokens, it is unlikely we call this function in real use case. We implement to make this a helper function for testing all cases in getAccessToken().
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-02 UTC."],[],[]]