Package
gtokenConstructors
(constructor)(options)
constructor
(
options
?:
TokenOptions
);
Create a GoogleToken.
Properties
accessToken
get
accessToken
()
:
string
|
undefined
;
additionalClaims
additionalClaims
?:
{};
eagerRefreshThresholdMillis
eagerRefreshThresholdMillis
?:
number
;
email
?:
string
;
expiresAt
expiresAt
?:
number
;
idToken
get
idToken
()
:
string
|
undefined
;
iss
iss
?:
string
;
key
key
?:
string
;
keyFile
keyFile
?:
string
;
rawToken
rawToken
?:
TokenData
;
refreshToken
get
refreshToken
()
:
string
|
undefined
;
scope
scope
?:
string
;
sub
sub
?:
string
;
tokenExpires
tokenExpires
?:
number
;
tokenType
get
tokenType
()
:
string
|
undefined
;
transporter
transporter
:
Transporter
;
Methods
getCredentials(keyFile)
getCredentials
(
keyFile
:
string
)
:
Promise<Credentials>
;
Given a keyFile, extract the key and client email if available
keyFile
string
Path to a json, pem, or p12 file that contains the key.
Promise
< Credentials
>
an object with privateKey and clientEmail properties
getToken(opts)
getToken
(
opts
?:
GetTokenOptions
)
:
Promise<TokenData>
;
Returns a cached token or retrieves a new one from Google.
getToken(callback, opts)
getToken
(
callback
:
GetTokenCallback
,
opts
?:
GetTokenOptions
)
:
void
;
void
hasExpired()
hasExpired
()
:
boolean
;
Returns whether the token has expired.
true if the token has expired, false otherwise.
boolean
isTokenExpiring()
isTokenExpiring
()
:
boolean
;
Returns whether the token will expire within eagerRefreshThresholdMillis
true if the token will be expired within eagerRefreshThresholdMillis, false otherwise.
boolean
revokeToken()
revokeToken
()
:
Promise<void>
;
Revoke the token if one is set.
Promise
<void>
revokeToken(callback)
revokeToken
(
callback
:
(
err
?:
Error
)
=
>
void
)
:
void
;
callback
(err?: Error
) => void
void