Send feedback
Class AuthClient (8.7.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 8.7.0 keyboard_arrow_down
Inheritance
EventEmitter
>
AuthClient
Package
google-auth-library
Properties
credentials
credentials: Credentials;
eagerRefreshThresholdMillis
eagerRefreshThresholdMillis: number;
forceRefreshOnFailure
forceRefreshOnFailure: boolean;
projectId
projectId?: string | null;
quotaProjectId
The quota project ID. The quota project can be used by client libraries for the billing purpose. See Working with quotas
transporter
transporter: DefaultTransporter;
Methods
protected addSharedMetadataHeaders(headers: Headers): Headers;
Append additional headers, e.g., x-goog-user-project, shared across the classes inheriting AuthClient. This method should be used by any method that overrides getRequestMetadataAsync(), which is a shared helper for setting request information in both gRPC and HTTP API calls.
Parameter Name Description headers
Headers
object to append additional headers to.
Returns Type Description Headers
getAccessToken()
abstract getAccessToken(): Promise<{
token?: string | null;
res?: GaxiosResponse | null;
}>;
A promise that resolves with the current GCP access token response. If the current credential is expired, a new one is retrieved.
Returns Type Description Promise <{
token?: string | null;
res?: GaxiosResponse | null;
}>
abstract getRequestHeaders(url?: string): Promise<Headers>;
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>' }
Parameter Name Description url
string
The URI being authorized.
Returns Type Description Promise <Headers >
request(opts)
abstract request<T>(opts: GaxiosOptions): GaxiosPromise<T>;
Provides an alternative Gaxios request implementation with auth credentials
Parameter Name Description opts
GaxiosOptions
Returns Type Description GaxiosPromise <T>
Type Parameter Name Description T
setCredentials(credentials)
setCredentials(credentials: Credentials): void;
Sets the auth credentials.
Returns Type Description void
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-03-16 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?