{
  "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",
  "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)_ timestamp for when the initial access token times out. In **milliseconds** after 1.1.1970.\n\nSee [https://developers.google.com/accounts/docs/OAuth2WebServer#offline]() for generating the required credentials\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); // timestamp after 1.1.1970 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    });\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**",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/andris9/xoauth2/issues"
  },
  "_id": "xoauth2@0.1.8",
  "dist": {
    "shasum": "375f9ac3989a61687c32f25be7b5cbe1105bf3d9"
  },
  "_from": "xoauth2@~0.1",
  "_resolved": "https://registry.npmjs.org/xoauth2/-/xoauth2-0.1.8.tgz"
}
