Class JWTAccess (7.14.1)

Package

google-auth-library

Constructors

(constructor)(email, key, keyId, eagerRefreshThresholdMillis)

constructor(email?: string | null, key?: string | null, keyId?: string | null, eagerRefreshThresholdMillis?: number);

JWTAccess service account credentials.

Create a new access token by using the credential to create a new JWT token that's recognized as the access token.

Parameters
NameDescription
email string | null

the service account email address.

key string | null

the private key that will be used to sign the token.

keyId string | null

the ID of the private key used to sign the token.

eagerRefreshThresholdMillis number

Properties

eagerRefreshThresholdMillis

eagerRefreshThresholdMillis: number;

email

email?: string | null;

key

key?: string | null;

keyId

keyId?: string | null;

projectId

projectId?: string;

Methods

fromJSON(json)

fromJSON(json: JWTInput): void;

Create a JWTAccess credentials instance using the given input options.

Parameter
NameDescription
json JWTInput

The input object.

Returns
TypeDescription
void

fromStream(inputStream)

fromStream(inputStream: stream.Readable): Promise<void>;

Create a JWTAccess credentials instance using the given input stream.

Parameter
NameDescription
inputStream stream.Readable

The input stream.

Returns
TypeDescription
Promise<void>

fromStream(inputStream, callback)

fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void;
Parameters
NameDescription
inputStream stream.Readable
callback (err?: Error) => void
Returns
TypeDescription
void

getCachedKey(url, scopes)

getCachedKey(url?: string, scopes?: string | string[]): string;

Ensures that we're caching a key appropriately, giving precedence to scopes vs. url

Parameters
NameDescription
url string

The URI being authorized.

scopes string | string[]

The scope or scopes being authorized

Returns
TypeDescription
string

A string that returns the cached key.

getRequestHeaders(url, additionalClaims, scopes)

getRequestHeaders(url?: string, additionalClaims?: Claims, scopes?: string | string[]): Headers;

Get a non-expired access token, after refreshing if necessary.

Parameters
NameDescription
url string

The URI being authorized.

additionalClaims Claims

An object with a set of additional claims to include in the payload.

scopes string | string[]
Returns
TypeDescription
Headers

An object that includes the authorization header.