node-googleapis

0.0.3 • Public • Published

node-googleapis

Javascirpt library for getting accessToken from authToken or refreshToken and getting userInfo for scope

  • npm (Node.js package manager)
npm install node-googleapis --save

Usage

Modular include:

const api = require('node-googleapis');
...
 
const file = '/home/ubuntu/client_secret.json'
var auth_token = '****************************'
const scope = 'https://www.google.com/m8/feeds/contacts/default/thin/?alt=json&max-results=10000'
 
api.init(file) // initialize api with client_id and client_secret
 
api.getTokens(auth_token)
.then(tokens =>  console.log(tokens)) // refresh_token, access_token
.catch(err => console.log(err))
 
api.refreshToken(tokens.refresh_token)
.then(tokens => console.log(tokens)) // new access_token
.catch(err => console.log(err))
 
api.scopeData(scope, tokens.accessToken)
.then(data => console.log(data))
.catch(err => console.log(err))
 

Package Sidebar

Install

npm i node-googleapis

Weekly Downloads

205

Version

0.0.3

License

MIT

Last publish

Collaborators

  • prabodh