Send feedback
Class GoogleToken (5.3.2) Stay organized with collections
Save and categorize content based on your preferences.
Version 5.3.2 keyboard_arrow_down
Package
gtoken
Constructors
(constructor)(options)
constructor
(
options
?:
TokenOptions
);
Parameter
Properties
accessToken
get
accessToken
()
:
string
|
undefined
;
additionalClaims
eagerRefreshThresholdMillis
eagerRefreshThresholdMillis
?:
number
;
email
expiresAt
idToken
get
idToken
()
:
string
|
undefined
;
iss
key
keyFile
rawToken
refreshToken
get
refreshToken
()
:
string
|
undefined
;
scope
sub
tokenExpires
tokenType
get
tokenType
()
:
string
|
undefined
;
Methods
getCredentials(keyFile)
getCredentials
(
keyFile
:
string
)
:
Promise<Credentials>
;
Given a keyFile, extract the key and client email if available
Parameter Name
Description
keyFile
string
Path to a json, pem, or p12 file that contains the key.
Returns Type
Description
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.
Parameter
Returns
getToken(callback, opts)
getToken
(
callback
:
GetTokenCallback
,
opts
?:
GetTokenOptions
)
:
void
;
Parameters
Returns
hasExpired()
hasExpired
()
:
boolean
;
Returns whether the token has expired.
true if the token has expired, false otherwise.
Returns
isTokenExpiring()
isTokenExpiring
()
:
boolean
;
Returns whether the token will expire within eagerRefreshThresholdMillis
true if the token will be expired within eagerRefreshThresholdMillis, false otherwise.
Returns
revokeToken()
revokeToken
()
:
Promise<void>
;
Revoke the token if one is set.
Returns
revokeToken(callback)
revokeToken
(
callback
:
(
err
?:
Error
)
=
>
void
)
:
void
;
Parameter Name
Description
callback
(err?: Error
) => void
Returns
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 2025-09-04 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,[]]