Package
google-auth-libraryConstructors
(constructor)(options)
constructor
(
options
:
JWTOptions
);
JWT service account credentials.
Retrieve access token using gtoken.
(constructor)(email, keyFile, key, scopes, subject, keyId)
constructor
(
email
?:
string
,
keyFile
?:
string
,
key
?:
string
,
scopes
?:
string
|
string
[],
subject
?:
string
,
keyId
?:
string
);
Constructs a new instance of the JWT
class
email
string
keyFile
string
key
string
scopes
string | string[]
subject
string
keyId
string
Properties
additionalClaims
additionalClaims
?:
{};
defaultScopes
defaultScopes
?:
string
|
string
[];
defaultServicePath
defaultServicePath
?:
string
;
email
?:
string
;
gtoken
gtoken
?:
GoogleToken
;
key
key
?:
string
;
keyFile
keyFile
?:
string
;
keyId
keyId
?:
string
;
scope
scope
?:
string
;
scopes
scopes
?:
string
|
string
[];
subject
subject
?:
string
;
useJWTAccessWithScope
useJWTAccessWithScope
?:
boolean
;
Methods
authorize()
authorize
()
:
Promise<Credentials>
;
Get the initial access token using gToken.
authorize(callback)
authorize
(
callback
:
(
err
:
Error
|
null
,
result
?:
Credentials
)
=
>
void
)
:
void
;
void
createScoped(scopes)
createScoped
(
scopes
?:
string
|
string
[])
:
JWT
;
Creates a copy of the credential with the specified scopes.
scopes
string | string[]
List of requested scopes or a single scope. The cloned instance.
fetchIdToken(targetAudience)
fetchIdToken
(
targetAudience
:
string
)
:
Promise<string>
;
Fetches an ID token.
targetAudience
string
the audience for the fetched ID token.
Promise
<string>
fromAPIKey(apiKey)
fromAPIKey
(
apiKey
:
string
)
:
void
;
Creates a JWT credentials instance using an API Key for authentication.
apiKey
string
The API Key in string form.
void
fromJSON(json)
fromJSON
(
json
:
JWTInput
)
:
void
;
Create a JWT credentials instance using the given input options.
void
fromStream(inputStream)
fromStream
(
inputStream
:
stream
.
Readable
)
:
Promise<void>
;
Create a JWT credentials instance using the given input stream.
inputStream
stream.Readable
The input stream.
Promise
<void>
fromStream(inputStream, callback)
fromStream
(
inputStream
:
stream
.
Readable
,
callback
:
(
err
?:
Error
|
null
)
=
>
void
)
:
void
;
inputStream
stream.Readable
callback
(err?: Error
| null) => void
void
getCredentials()
getCredentials
()
:
Promise<CredentialBody>
;
Using the key or keyFile on the JWT client, obtain an object that contains the key and the client email.
getRequestMetadataAsync(url)
protected
getRequestMetadataAsync
(
url
?:
string
|
null
)
:
Promise<RequestMetadataResponse>
;
Obtains the metadata to be sent with the request.
url
string | null
the URI being authorized.
Promise
< RequestMetadataResponse
>
refreshTokenNoCache(refreshToken)
protected
refreshTokenNoCache
(
refreshToken
?:
string
|
null
)
:
Promise<GetTokenResponse>
;
Refreshes the access token.
refreshToken
string | null
ignored
Promise
< GetTokenResponse
>