{"id":16144370,"url":"https://github.com/ryanj/meantesting","last_synced_at":"2025-09-11T06:36:06.682Z","repository":{"id":15716759,"uuid":"18454818","full_name":"ryanj/meantesting","owner":"ryanj","description":"a scratch pad","archived":false,"fork":false,"pushed_at":"2014-04-04T23:18:18.000Z","size":33320,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T02:16:42.227Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-04T22:45:48.000Z","updated_at":"2014-04-04T23:18:18.000Z","dependencies_parsed_at":"2022-07-06T16:03:37.873Z","dependency_job_id":null,"html_url":"https://github.com/ryanj/meantesting","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanj%2Fmeantesting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanj%2Fmeantesting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanj%2Fmeantesting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanj%2Fmeantesting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanj","download_url":"https://codeload.github.com/ryanj/meantesting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543598,"owners_count":20955865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T00:12:48.051Z","updated_at":"2025-04-06T20:15:51.666Z","avatar_url":"https://github.com/ryanj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanj%2Fmeantesting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanj%2Fmeantesting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanj%2Fmeantesting/lists"}