{"name":"gapitoken","version":"0.0.3","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"},"_id":"gapitoken@0.0.3","dist":{"shasum":"7e2613e0bed1ba6069e5ba1532cf67ee0576871b","tarball":"http://registry-npm.ywwl.com/gapitoken/download/gapitoken-0.0.3.tgz","integrity":"sha512-arzuxLg5PYVyD2XjAFT5wrfIWKnhbuhaBzCOB9hNeQXHl25C5uQI+sd7MuMFQnnDaHpLNhBMBIQPkHImGVYaAA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcHKUtdE7HDPPZPN40L12HMiriJIN3DPVOuz8iewvgSgIgdBkdeC+5o9RSHHdKqz9qmmu4I/N8M6ZeTuLv033UPJc="}],"size":1716,"noattachment":false,"key":"/gapitoken/-/gapitoken-0.0.3.tgz"},"_from":".","_npmVersion":"1.2.18","_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":1371364810152,"_cnpm_publish_time":1371364810152,"dist-tags":{"latest":"0.1.5"}}