{"name":"gapitoken","version":"0.1.4","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","request":"^2.54.0"},"gitHead":"85db3398a4848a2513485a50742ffcd0b5601e09","bugs":{"url":"https://github.com/bsphere/node-gapitoken/issues"},"homepage":"https://github.com/bsphere/node-gapitoken","_id":"gapitoken@0.1.4","scripts":{},"_shasum":"643dedb26cb142466f62b73d2782e7822a6f1ad8","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"bsphere","email":"gbenhaim@gmail.com"},"maintainers":[{"name":"bsphere","email":"gbenhaim@gmail.com"}],"dist":{"shasum":"643dedb26cb142466f62b73d2782e7822a6f1ad8","tarball":"http://registry-npm.ywwl.com/gapitoken/download/gapitoken-0.1.4.tgz","integrity":"sha512-N8+W8KTDYakHXSqm/6rCs+8ic8QS1EC4oK9J+Aqv+bxhu1tDffV9A710rngm1Q/Tzr89VHZiCTOXuVnwGUHfsw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnXq81q3rRU9NlVJ/hSu7PIcdR+gQ+sfNc8jr9GSgoEgIhAJNdFHtevIxVUL5BUP49OxgkQvksM+nyNgQIXZB6hJ/k"}],"size":1897,"noattachment":false,"key":"/gapitoken/-/gapitoken-0.1.4.tgz"},"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":1428414566384,"_cnpm_publish_time":1428414566384,"dist-tags":{"latest":"0.1.5"}}