{"_id":"xoauth2","_rev":"252246","name":"xoauth2","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"time":{"modified":"2021-06-03T16:15:41.000Z","created":"2012-09-10T10:02:23.639Z","1.2.0":"2016-07-29T08:07:31.669Z","1.1.0":"2015-07-14T20:28:43.224Z","1.0.0":"2014-10-13T14:53:26.864Z","0.1.8":"2013-05-02T08:14:07.643Z","0.1.7":"2013-03-12T07:52:55.720Z","0.1.6":"2013-02-25T14:14:50.685Z","0.1.5":"2013-01-28T13:47:19.873Z","0.1.4":"2012-12-04T09:20:09.271Z","0.1.3":"2012-10-09T08:23:04.160Z","0.1.2":"2012-09-18T11:04:30.936Z","0.1.1":"2012-09-10T13:56:50.924Z","0.1.0":"2012-09-10T10:02:23.639Z"},"users":{"kahboom":true,"stany":true,"roxnz":true,"abuelwafa":true,"dabin":true,"quocnguyen":true,"jasperdm":true},"author":{"name":"Andris Reinman"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"versions":{"1.2.0":{"name":"xoauth2","version":"1.2.0","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"src/xoauth2.js","scripts":{"test":"grunt"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","Yahoo","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","devDependencies":{"chai":"*","grunt":"*","grunt-contrib-jshint":"*","grunt-mocha-test":"*","sinon":"*"},"gitHead":"07da76d8aaa129a988304a4337d8b2c7593b05bb","bugs":{"url":"https://github.com/andris9/xoauth2/issues"},"homepage":"https://github.com/andris9/xoauth2#readme","_id":"xoauth2@1.2.0","_shasum":"f2eefac11472c971ea3bc46e554eb4b1232146e5","_from":".","_npmVersion":"3.9.5","_nodeVersion":"6.2.2","_npmUser":{"name":"andris","email":"andris@kreata.ee"},"dist":{"shasum":"f2eefac11472c971ea3bc46e554eb4b1232146e5","size":7378,"noattachment":false,"key":"/xoauth2/-/xoauth2-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-1.2.0.tgz"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/xoauth2-1.2.0.tgz_1469779649866_0.70530393300578"},"directories":{},"publish_time":1469779651669,"_cnpm_publish_time":1469779651669,"_hasShrinkwrap":false},"1.1.0":{"name":"xoauth2","version":"1.1.0","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"src/xoauth2.js","scripts":{"test":"grunt"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","Yahoo","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","devDependencies":{"chai":"*","grunt":"*","grunt-contrib-jshint":"*","grunt-mocha-test":"*","sinon":"*"},"gitHead":"2f4690b30ee7111c6bb0d4026fd1dad16e9981db","bugs":{"url":"https://github.com/andris9/xoauth2/issues"},"homepage":"https://github.com/andris9/xoauth2#readme","_id":"xoauth2@1.1.0","_shasum":"7ea2a796317b0b5b59a1c46becccca9fbf96f934","_from":".","_npmVersion":"2.12.0","_nodeVersion":"0.12.2","_npmUser":{"name":"andris","email":"andris@kreata.ee"},"dist":{"shasum":"7ea2a796317b0b5b59a1c46becccca9fbf96f934","size":6444,"noattachment":false,"key":"/xoauth2/-/xoauth2-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-1.1.0.tgz"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1436905723224,"_cnpm_publish_time":1436905723224,"_hasShrinkwrap":false},"1.0.0":{"name":"xoauth2","version":"1.0.0","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"src/xoauth2.js","scripts":{"test":"grunt"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","devDependencies":{"chai":"*","grunt":"*","grunt-contrib-jshint":"*","grunt-mocha-test":"*","sinon":"*"},"gitHead":"c8bce358808bd0c84c4420661bbde09c321bbcae","bugs":{"url":"https://github.com/andris9/xoauth2/issues"},"homepage":"https://github.com/andris9/xoauth2","_id":"xoauth2@1.0.0","_shasum":"bef23c1fa25b8c01f0f8cd5ec25fa1ba129fc2c1","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"andris","email":"andris@node.ee"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"dist":{"shasum":"bef23c1fa25b8c01f0f8cd5ec25fa1ba129fc2c1","size":6009,"noattachment":false,"key":"/xoauth2/-/xoauth2-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-1.0.0.tgz"},"directories":{},"publish_time":1413212006864,"_cnpm_publish_time":1413212006864,"_hasShrinkwrap":false},"0.1.8":{"name":"xoauth2","version":"0.1.8","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","readmeFilename":"README.md","_id":"xoauth2@0.1.8","dist":{"shasum":"b916ff10ecfb54320f16f24a3e975120653ab0d2","size":3234,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.8.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"andris","email":"andris@node.ee"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1367482447643,"_cnpm_publish_time":1367482447643,"_hasShrinkwrap":false},"0.1.7":{"name":"xoauth2","version":"0.1.7","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","readmeFilename":"README.md","_id":"xoauth2@0.1.7","dist":{"shasum":"ce055d5ab904a170ca2f6aff932f063b349e3ba5","size":3227,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.7.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"andris","email":"andris@node.ee"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1363074775720,"_cnpm_publish_time":1363074775720,"_hasShrinkwrap":false},"0.1.6":{"name":"xoauth2","version":"0.1.6","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","readmeFilename":"README.md","_id":"xoauth2@0.1.6","dist":{"shasum":"d9f5101cf35e8e7f2d2406cd615e62526b449616","size":3120,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.6.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"andris","email":"andris@node.ee"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1361801690685,"_cnpm_publish_time":1361801690685,"_hasShrinkwrap":false},"0.1.5":{"name":"xoauth2","version":"0.1.5","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","dependencies":{"request":"*"},"readmeFilename":"README.md","_id":"xoauth2@0.1.5","dist":{"shasum":"f476c12a13dc810e382400108dfc23f252f95690","size":2892,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.5.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"andris","email":"andris@node.ee"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1359380839873,"_cnpm_publish_time":1359380839873,"_hasShrinkwrap":false},"0.1.4":{"name":"xoauth2","version":"0.1.4","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","dependencies":{"request":"*"},"_id":"xoauth2@0.1.4","dist":{"shasum":"e3b43347d3502dd91ecb551d4386ab62f75c226a","size":2765,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.4.tgz"},"_npmVersion":"1.1.61","_npmUser":{"name":"andris","email":"andris@node.ee"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1354612809271,"_cnpm_publish_time":1354612809271,"_hasShrinkwrap":false},"0.1.3":{"name":"xoauth2","version":"0.1.3","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","dependencies":{"request":"*"},"_id":"xoauth2@0.1.3","dist":{"shasum":"4448cb94fb1032c02cb2c81e95008674dcd2d1c6","size":2664,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.3.tgz"},"_npmVersion":"1.1.61","_npmUser":{"name":"andris","email":"andris@node.ee"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1349770984160,"_cnpm_publish_time":1349770984160,"_hasShrinkwrap":false},"0.1.2":{"name":"xoauth2","version":"0.1.2","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","dependencies":{"request":"*"},"_id":"xoauth2@0.1.2","dist":{"shasum":"cbf2ecc1e08f240257965e11b3b41cec6d9e6f40","size":2618,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.2.tgz"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1347966270936,"_cnpm_publish_time":1347966270936,"_hasShrinkwrap":false},"0.1.1":{"name":"xoauth2","version":"0.1.1","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","dependencies":{"request":"*"},"_id":"xoauth2@0.1.1","dist":{"shasum":"577ae983decf45e98ff4df2c89d0f5fcca1b9416","size":2634,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.1.tgz"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1347285410924,"_cnpm_publish_time":1347285410924,"_hasShrinkwrap":false},"0.1.0":{"name":"xoauth2","version":"0.1.0","description":"XOAuth2 token generation for accessing GMail SMTP and IMAP","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/andris9/xoauth2.git"},"keywords":["XOAUTH","XOAUTH2","GMail","SMTP","IMAP"],"author":{"name":"Andris Reinman"},"license":"MIT","dependencies":{"request":"*"},"_id":"xoauth2@0.1.0","dist":{"shasum":"73e7e2c82ec50556b6e9918247697abc33333a73","size":2139,"noattachment":false,"key":"/xoauth2/-/xoauth2-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/xoauth2/download/xoauth2-0.1.0.tgz"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"directories":{},"publish_time":1347271343639,"_cnpm_publish_time":1347271343639,"_hasShrinkwrap":false}},"readme":"xoauth2\n=======\n\nXOAuth2 token generation with node.js\n\n## Installation\n\n    npm install xoauth2\n\n## Usage\n\n**xoauth2** generates XOAUTH2 login tokens from provided Client and User credentials.\n\nUse `xoauth2.createXOAuth2Generator(options)` to initialize Token Generator\n\nPossible options values:\n\n  * **user** _(Required)_ User e-mail address\n  * **accessUrl** _(Optional)_ Endpoint for token generation (defaults to *https://accounts.google.com/o/oauth2/token*)\n  * **clientId** _(Required)_ Client ID value\n  * **clientSecret** _(Required)_ Client secret value\n  * **refreshToken** _(Required)_ Refresh token for an user\n  * **accessToken** _(Optional)_ initial access token. If not set, a new one will be generated\n  * **timeout** _(Optional)_ TTL in **seconds**\n  * **customHeaders** _(Optional)_ custom headers to send during token generation request [yahoo requires `Authorization: Basic Base64(clientId:clientSecret)` ](https://developer.yahoo.com/oauth2/guide/flows_authcode/#step-5-exchange-refresh-token-for-new-access-token)\n  * **customParams** _(Optional)_ custom payload to send on getToken request [yahoo requires redirect_uri to be specified](https://developer.yahoo.com/oauth2/guide/flows_authcode/#step-5-exchange-refresh-token-for-new-access-token)\n\nSee [https://developers.google.com/identity/protocols/OAuth2WebServer#offline](https://developers.google.com/identity/protocols/OAuth2WebServer#offline) for generating the required credentials\n\nFor Google service account the option values are:\n\n  * **service** _(Required)_ Service account email.\n  * **user** _(Required)_ User e-mail address\n  * **scope** _(Required)_ OAuth2 scope.\n  * **privateKey** _(Required)_ Private key issued for the service account in PEM format, as a string.\n  * **serviceRequestTimeout** _(Optional)_ Expiration value to use in the token request in **seconds**. Maximum is 3600.\n  * **accessUrl** _(Optional)_ Endpoint for token generation (defaults to *https://accounts.google.com/o/oauth2/token*)\n  * **accessToken** _(Optional)_ initial access token. If not set, a new one will be generated\n  * **timeout** _(Optional)_ TTL in **seconds**\n  * **customHeaders** _(Optional)_ custom headers to send during token generation request\n  * **customParams** _(Optional)_ custom payload to send on getToken request\n\n### Methods\n\n#### Request an access token\n\nUse `xoauth2obj.getToken(callback)` to get an access token. If a cached token is found and it should not be expired yet, the cached value will be used.\n\n#### Request for generating a new access token\n\nUse `xoauth2obj.generateToken(callback)` to get an access token. Cache will not be used and a new token is generated.\n\n#### Update access token values\n\nUse `xoauth2obj.updateToken(accessToken, timeout)` to set the new value for the xoauth2 access token. This function emits 'token'\n\n### Events\n\nIf a new token value has been set, `'token'` event is emitted.\n\n    xoauth2obj.on(\"token\", function(token){\n        console.log(\"User: \", token.user); // e-mail address\n        console.log(\"New access token: \", token.accessToken);\n        console.log(\"New access token timeout: \", token.timeout); // TTL in seconds\n    });\n\n### Example\n\n    var xoauth2 = require(\"xoauth2\"),\n        xoauth2gen;\n\n    xoauth2gen = xoauth2.createXOAuth2Generator({\n        user: \"user@gmail.com\",\n        clientId: \"{Client ID}\",\n        clientSecret: \"{Client Secret}\",\n        refreshToken: \"{User Refresh Token}\",\n        customHeaders: {\n          \"HeaderName\": \"HeaderValue\"\n        },\n        customPayload: {\n          \"payloadParamName\": \"payloadValue\"\n        }\n    });\n\n    // ... or for a Google service account\n    xoauth2gen = xoauth2.createXOAuth2Generator({\n        user: \"user@gmail.com\",\n        service: '{Service Email Address}',\n        scope: 'https://mail.google.com/',\n        privateKey: '{Private Key in PEM format}'\n    });\n\n    // SMTP/IMAP\n    xoauth2gen.getToken(function(err, token){\n        if(err){\n            return console.log(err);\n        }\n        console.log(\"AUTH XOAUTH2 \" + token);\n    });\n\n    // HTTP\n    xoauth2gen.getToken(function(err, token, accessToken){\n        if(err){\n            return console.log(err);\n        }\n        console.log(\"Authorization: Bearer \" + accessToken);\n    });\n\n## License\n\n**MIT**\n","_attachments":{},"homepage":"https://github.com/andris9/xoauth2#readme","bugs":{"url":"https://github.com/andris9/xoauth2/issues"},"license":"MIT"}