JWTAccess

JWTAccess

new JWTAccess(email, key, keyId)

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:
Name Type Description
email

the service account email address.

key

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

keyId

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

Methods

fromJSON(json)

Create a JWTAccess credentials instance using the given input options.

Parameters:
Name Type Description
json

The input object.

getCachedKey(url, scopes)

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

Parameters:
Name Type Description
url

The URI being authorized.

scopes

The scope or scopes being authorized

Returns:
Type Description

A string that returns the cached key.

getRequestHeaders(url, additionalClaims)

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

Parameters:
Name Type Description
url

The URI being authorized.

additionalClaims

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

Returns:
Type Description

An object that includes the authorization header.

(static) getExpirationTime(iat)

Returns an expiration time for the JWT token.

Parameters:
Name Type Description
iat

The issued at time for the JWT.

Returns:
Type Description

An expiration time for the JWT.