{"name":"gapitoken","version":"0.1.2","description":"Node.js module for Google API service account authorization (Server to Server flow)","main":"gapitoken.js","repository":{"type":"git","url":"git://github.com/bsphere/node-gapitoken.git"},"keywords":["jwt","jws","google","api","token","service"],"author":{"name":"Gal Ben-Haim"},"license":"MIT","dependencies":{"jws":"0.0.2"},"bugs":{"url":"https://github.com/bsphere/node-gapitoken/issues"},"homepage":"https://github.com/bsphere/node-gapitoken","_id":"gapitoken@0.1.2","dist":{"shasum":"5ce4c2ee8e147eb5afb1c0beed119a664067a4e8","tarball":"http://registry-npm.ywwl.com/gapitoken/download/gapitoken-0.1.2.tgz","integrity":"sha512-GJav3hLY0ElXAqU1t6Yl2AARpmCyOzdv5jbfVpmScl2avIXew/jz9+4m9+AgTC/XTekhILDtv9Zw1JHEKAQplg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDmXM4gclcOwNuiXzFn6JZBs5HpwS5QB2tvR3etj+HHcAiA57hWAUj33eOM51nzRAbeyEzZ/Cc4h1ypqPeU62k7iOg=="}],"size":1954,"noattachment":false,"key":"/gapitoken/-/gapitoken-0.1.2.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"bsphere","email":"gbenhaim@gmail.com"},"maintainers":[{"name":"bsphere","email":"gbenhaim@gmail.com"}],"directories":{},"readme":"node-gapitoken\n==============\n\nNode.js module for Google API service account authorization (Server to Server flow). \n\n[![Build Status](https://travis-ci.org/bsphere/node-gapitoken.svg)](https://travis-ci.org/bsphere/node-gapitoken)\n\n\nInstallation\n------------\n\n\tnpm install gapitoken\n\t\nUsage\n-----\n\n    var GAPI = require('gapitoken');\n \n    var gapi = new GAPI({\n        iss: 'service account email address from Google API console',\n        scope: 'space delimited list of requested scopes',\n        keyFile: 'path to private_key.pem'\n    }, function(err) {\n       if (err) { return console.log(err); }\n \n       gapi.getToken(function(err, token) {\n           if (err) { return console.log(err); }\n           console.log(token);\n       });     \n    });\n\nAnother option is to pass the private key as a string\n\n    var key = \"-----BEGIN RSA PRIVATE KEY-----\\n\\\n    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\\n\\\n    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\\n\\\n    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\\n\\\n    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\\n\\\n    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\\n\\\n    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\\n\\\n    -----END RSA PRIVATE KEY-----\";\n\n    var gapi = new GAPI({\n        iss: 'service account email address from Google API console',\n        scope: 'space delimited list of requested scopes',\n        key: key\n    }, function() {\n       gapi.getToken(function(err, token) {\n           if (err) { return console.log(err); }\n           console.log(token);\n       });     \n    });\n\n    \n* for using node-gapitoken to access Google Cloud Storage see https://github.com/bsphere/node-gcs\n\nCreating a Private key file\n---------------------------\n\n1) Login to Google API Console, and under \"API Access\" create a \"service account\" for your project.\n\n2) Download the .p12 private key file\n\n3) Convert the .p12 file to .pem: `openssl pkcs12 -in key.p12 -out key.pem -nocerts`\n\nNOTE: You must set a passphrase for the .pem file\n\n4) Remove the passphrase from the .pem file: `openssl rsa -in key.pem -out key.pem`\n","publish_time":1395256679460,"_cnpm_publish_time":1395256679460,"dist-tags":{"latest":"0.1.5"}}