Gathering detailed insights and metrics for @leonardodino/gtoken
Gathering detailed insights and metrics for @leonardodino/gtoken
Gathering detailed insights and metrics for @leonardodino/gtoken
Gathering detailed insights and metrics for @leonardodino/gtoken
🔑 Google Auth Service Account Tokens for Node.js
npm install @leonardodino/gtoken
Typescript
Module System
Node Version
NPM Version
TypeScript (90.32%)
JavaScript (7.44%)
Python (2.24%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
117 Stars
395 Commits
44 Forks
47 Watchers
89 Branches
141 Contributors
Updated on Jul 09, 2025
Latest Version
3.0.2
Package Id
@leonardodino/gtoken@3.0.2
Unpacked Size
20.72 kB
Size
6.60 kB
File Count
6
NPM Version
5.6.0
Node Version
8.10.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Node.js Google Authentication Service Account Tokens
1npm install @leonardodino/gtoken
or
1yarn add @leonardodino/gtoken
1const key = '-----BEGIN RSA PRIVATE KEY-----\nXXXXXXXXXXX...'; 2const { GoogleToken } = require('@leonardodino/gtoken'); 3const gtoken = new GoogleToken({ 4 email: 'my_service_account_email@developer.gserviceaccount.com', 5 scope: ['https://scope1', 'https://scope2'], // or space-delimited string of scopes 6 key: key 7});
Various options that can be set when creating initializing the
gtoken
object.
options.email or options.iss
: The service account email address.options.scope
: An array of scope strings or space-delimited string of scopes.options.sub
: The email address of the user requesting delegated access.options.key
: The raw RSA private key value.Returns the cached token or requests a new one and returns it.
1gtoken.getToken(function(err, token) { 2 if (err) { 3 console.log(err); 4 return; 5 } 6 console.log(token); 7});
You can also use the async/await style API:
1const token = await gtoken.getToken() 2console.log(token);
Or use promises: or
1gtoken.getToken() 2 .then(token => { 3 console.log(token) 4 }) 5 .catch(e => console.error);
Various properties set on the gtoken object after call to
.getToken()
.
gtoken.token
: The access token.gtoken.expiresAt
: The expiry date as milliseconds since 1970/01/01gtoken.key
: The raw key value.gtoken.rawToken
: Most recent raw token data received from Google.Returns true if the token has expired, or token does not exist.
1gtoken.getToken(function(err, token) { 2 if(token) { 3 gtoken.hasExpired(); // false 4 } 5});
Revoke the token if set.
1gtoken.revokeToken(function(err) { 2 if (err) { 3 console.log(err); 4 return; 5 } 6 console.log('Token revoked!'); 7});
New features:
Breaking changes:
keyFile
option)getCredentials
method.ensureEmail
private method.New features:
Breaking changes:
GoogleToken
is now a class type, and must be instantiated.GoogleToken.expires_at
renamed to GoogleToken.expiresAt
GoogleToken.raw_token
renamed to GoogleToken.rawToken
GoogleToken.token_expires
renamed to GoogleToken.tokenExpires
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 15/16 approved changesets -- score normalized to 9
Reason
6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
SAST tool is not run on all commits -- score normalized to 3
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More