Socket
Socket
Sign inDemoInstall

gtoken

Package Overview
Dependencies
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gtoken

Node.js Google Authentication Service Account Tokens


Version published
Weekly downloads
8.9M
decreased by-13.82%
Maintainers
4
Weekly downloads
 
Created

What is gtoken?

The gtoken npm package is designed to handle the acquisition and management of Google OAuth2 tokens. It simplifies the process of authenticating with Google APIs by managing the token generation, refresh, and validation processes.

What are gtoken's main functionalities?

Generate Access Token

This feature allows users to generate an access token by providing a key file and the required scopes. The token can then be used to authenticate requests to Google APIs.

const { GoogleToken } = require('gtoken');
const gtoken = new GoogleToken({
  keyFile: 'path/to/keyfile.json',
  scope: ['https://www.googleapis.com/auth/drive']
});
gtoken.getToken().then(token => {
  console.log(token);
}).catch(err => {
  console.error(err);
});

Refresh Token

This feature allows users to refresh their existing token when it expires. The refreshed token ensures continued access without needing to re-authenticate.

const { GoogleToken } = require('gtoken');
const gtoken = new GoogleToken({
  keyFile: 'path/to/keyfile.json',
  scope: ['https://www.googleapis.com/auth/drive'],
  token: existingToken
});
gtoken.refreshToken().then(newToken => {
  console.log(newToken);
}).catch(err => {
  console.error(err);
});

Other packages similar to gtoken

Keywords

FAQs

Package last updated on 30 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc