Send feedback
Class GoogleToken (7.0.1)
Stay organized with collections
Save and categorize content based on your preferences.
Version 7.0.1 keyboard_arrow_down
Package
gtoken
Constructors
(constructor)(options)
constructor ( options ?: TokenOptions );
Parameter Name Description options
TokenOptions
Configuration object.
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 ;
transporter
transporter : Transporter ;
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.
getToken(callback, opts)
getToken ( callback : GetTokenCallback , opts ?: GetTokenOptions ) : void ;
Returns Type Description void
hasExpired()
Returns whether the token has expired.
true if the token has expired, false otherwise.
Returns Type Description boolean
isTokenExpiring()
isTokenExpiring () : boolean ;
Returns whether the token will expire within eagerRefreshThresholdMillis
true if the token will be expired within eagerRefreshThresholdMillis, false otherwise.
Returns Type Description boolean
revokeToken()
revokeToken () : Promise<void> ;
Revoke the token if one is set.
Returns Type Description Promise <void>
revokeToken(callback)
revokeToken ( callback : ( err ?: Error ) = > void ) : void ;
Parameter Name Description callback
(err?: Error ) => void
Returns Type Description void
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-01-17 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-01-17 UTC."],[],[]]