Google authentication library to make dealing with tokens easier, with automatic storage/refreshing.
Last updated 6 years ago by leichtgewicht .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install google-cli-auth 
SYNC missed versions from official npm registry.


Command line helper tool to work with Google access tokens.


To use the API of Google any code will need to authenticate. This tool helps you to build a command line tool that uses the Google API.


  1. To use the module you need to install it.
$ npm i google-cli-auth --save
  1. You need get create a project in the Google Developers Console

  2. In the developers console (under APIs & auth) choose Credentials.

  3. (Under "OAuth") choose Create new client ID

  4. Choose Installed Application and Other

  5. Then you can setup your code with the CLIENT ID and CLIENT SECRET like this:

      name: 'my-app' // will be used to store the token under ~/.config/my-app/token.json
    , client_id: '...' // enter client id from the developer console
    , client_secret: '...' // enter client secret from the developer console
    , scope: [] // add scopes 
}, function (error, token) {
    token.access_token // your token 
    token.token_type // token type
    token.expires_at // timestamp when this token will be expired
    token.refresh(callback) // Refreshes the token

Note: There is more information about Scopes in the google developer docs.


There is another cli tool that does cli authentication. This tool is different in the sense that the token that you will get will be stored/retreived from the users config folder and offers methods to refresh the token.

Current Tags

  • 0.0.1                                ...           latest (6 years ago)

1 Versions

  • 0.0.1                                ...           6 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (2)
Dependents (2)

Copyright 2014 - 2016 © |