Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gtoken

Package Overview
Dependencies
Maintainers
4
Versions
48
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

  • 7.1.0
  • latest
  • legacy-14
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
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 01 Feb 2024

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