{"_id":"passport-oauth2-password-grant","_rev":"8-fb5558564212cea516437073b7f2fcc0","name":"passport-oauth2-password-grant","description":"OAuth 2.0 password grant authentication strategy for Passport.","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"passport-oauth2-password-grant","version":"0.0.1","description":"OAuth 2.0 password grant authentication strategy for Passport.","keywords":["passport","auth","authn","authentication","authz","authorization","oauth","oauth2","password"],"author":{"name":"Sean Burke","email":"leftmostcat@gmail.com"},"repository":{"type":"git","url":"git://github.com/leftmostcat/passport-oauth2-password-grant.git"},"bugs":{"url":"http://github.com/leftmostcat/passport-oauth2-password-grant/issues"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"main":"./lib","dependencies":{"passport-strategy":"1.x.x","passport-oauth2":"1.x.x","oauth":"0.9.x"},"devDependencies":{"mocha":"2.x.x","chai":"2.x.x","chai-passport-strategy":"0.2.x"},"engines":{"node":">= 0.4.0"},"scripts":{"test":"mocha"},"gitHead":"f6b8c39dc71aff20bddf522b8d6c2f5e4315d679","homepage":"https://github.com/leftmostcat/passport-oauth2-password-grant","_id":"passport-oauth2-password-grant@0.0.1","_shasum":"3bb5d83529abcca8c7ee7373db4932efa532dd0c","_from":".","_npmVersion":"2.7.0","_nodeVersion":"0.10.36","_npmUser":{"name":"leftmostcat","email":"leftmostcat@gmail.com"},"maintainers":[{"name":"leftmostcat","email":"leftmostcat@gmail.com"}],"dist":{"shasum":"3bb5d83529abcca8c7ee7373db4932efa532dd0c","tarball":"https://registry.npmjs.org/passport-oauth2-password-grant/-/passport-oauth2-password-grant-0.0.1.tgz","integrity":"sha512-U60hWIO+AY4XkDOyRCt3tWIFjL3PPLmvKM2QgpxJmCf5FyWo2KFByGEFP8RjP74QaJzpHyaIWRBr0OKVA0xubQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFLE+kfjrSv91elPNzyuTSp36eZ4hXWGzJSIF6y5pPgNAiEAwRBqs6RhZ/n2TGpuCCAmSqgNA2vVDq91zAEF5Wgv0Xw="}]}},"0.0.2":{"name":"passport-oauth2-password-grant","version":"0.0.2","description":"OAuth 2.0 password grant authentication strategy for Passport.","keywords":["passport","auth","authn","authentication","authz","authorization","oauth","oauth2","password"],"author":{"name":"Sean Burke","email":"leftmostcat@gmail.com"},"repository":{"type":"git","url":"git://github.com/leftmostcat/passport-oauth2-password-grant.git"},"bugs":{"url":"http://github.com/leftmostcat/passport-oauth2-password-grant/issues"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"main":"./lib","dependencies":{"passport-strategy":"1.x.x","passport-oauth2":"1.x.x","oauth":"0.9.x"},"devDependencies":{"mocha":"2.x.x","chai":"2.x.x","chai-passport-strategy":"0.2.x"},"engines":{"node":">= 0.4.0"},"scripts":{"test":"mocha"},"gitHead":"f57dc8d3b9f94004826e118d36a34f12d495d8d2","homepage":"https://github.com/leftmostcat/passport-oauth2-password-grant","_id":"passport-oauth2-password-grant@0.0.2","_shasum":"1bed5617a48fb69e071faf681d98e95f8f8f19c0","_from":".","_npmVersion":"2.7.0","_nodeVersion":"0.10.36","_npmUser":{"name":"leftmostcat","email":"leftmostcat@gmail.com"},"maintainers":[{"name":"leftmostcat","email":"leftmostcat@gmail.com"}],"dist":{"shasum":"1bed5617a48fb69e071faf681d98e95f8f8f19c0","tarball":"https://registry.npmjs.org/passport-oauth2-password-grant/-/passport-oauth2-password-grant-0.0.2.tgz","integrity":"sha512-5SDKjPPqOcNQXFwC0L4GU1BrcAjRj3kjBC2DkXxY5nCUkQR/rP/i3y/gN9aTt0V1i1+LHSDlJ7qyL4ZfF3O5EQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFcta/ul5Wq4msg6VwyIq/GV5AhDhtzIng0lsjXru9U8AiAOwAbWp1ADsuyCwsTPYzyM8MNFCP+SudDCymOL4LoZLg=="}]}},"0.0.3":{"name":"passport-oauth2-password-grant","version":"0.0.3","description":"OAuth 2.0 password grant authentication strategy for Passport.","keywords":["passport","auth","authn","authentication","authz","authorization","oauth","oauth2","password"],"author":{"name":"Sean Burke","email":"leftmostcat@gmail.com"},"repository":{"type":"git","url":"git://github.com/leftmostcat/passport-oauth2-password-grant.git"},"bugs":{"url":"http://github.com/leftmostcat/passport-oauth2-password-grant/issues"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"main":"./lib","dependencies":{"passport-strategy":"1.x.x","passport-oauth2":"1.x.x","oauth":"0.9.x"},"devDependencies":{"mocha":"2.x.x","chai":"2.x.x","chai-passport-strategy":"0.2.x"},"engines":{"node":">= 0.4.0"},"scripts":{"test":"mocha"},"gitHead":"af15f0d88c9c2d62dd8f88320662648d5486ac1d","homepage":"https://github.com/leftmostcat/passport-oauth2-password-grant","_id":"passport-oauth2-password-grant@0.0.3","_shasum":"12d48de373d0f35d74e78dc42afa75a2610aecef","_from":".","_npmVersion":"2.7.0","_nodeVersion":"0.10.36","_npmUser":{"name":"leftmostcat","email":"leftmostcat@gmail.com"},"maintainers":[{"name":"leftmostcat","email":"leftmostcat@gmail.com"}],"dist":{"shasum":"12d48de373d0f35d74e78dc42afa75a2610aecef","tarball":"https://registry.npmjs.org/passport-oauth2-password-grant/-/passport-oauth2-password-grant-0.0.3.tgz","integrity":"sha512-wbBQWlMhPcXgNgZzPO+MvRmhA6dFaa7d0i7vkFD4VNg+YW0TArVUR6O5Ka8lqG/OGvnVp8/COnDSVv5Oapgayg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCLJvO3MCmTVoMRPwRGgbgPYz8mw1nZli0E3BsE807AtgIgGgydcHoRudn8D1MqJlQqcgk6vmjby12muo4nw3wW7UU="}]}},"0.0.4":{"name":"passport-oauth2-password-grant","version":"0.0.4","description":"OAuth 2.0 password grant authentication strategy for Passport.","keywords":["passport","auth","authn","authentication","authz","authorization","oauth","oauth2","password"],"author":{"name":"Sean Burke","email":"leftmostcat@gmail.com"},"repository":{"type":"git","url":"git://github.com/leftmostcat/passport-oauth2-password-grant.git"},"bugs":{"url":"http://github.com/leftmostcat/passport-oauth2-password-grant/issues"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"main":"./lib","dependencies":{"passport-strategy":"1.x.x","passport-oauth2":"1.x.x","oauth":"0.9.x"},"devDependencies":{"mocha":"2.x.x","chai":"2.x.x","chai-passport-strategy":"0.2.x"},"engines":{"node":">= 0.4.0"},"scripts":{"test":"mocha"},"gitHead":"d7abc0ebec8b3dbb06be525f2a8c39a5b799e388","homepage":"https://github.com/leftmostcat/passport-oauth2-password-grant#readme","_id":"passport-oauth2-password-grant@0.0.4","_shasum":"c69a98da66bfd082f70ddf9ae34181493ebfaf54","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"leftmostcat","email":"leftmostcat@gmail.com"},"dist":{"shasum":"c69a98da66bfd082f70ddf9ae34181493ebfaf54","tarball":"https://registry.npmjs.org/passport-oauth2-password-grant/-/passport-oauth2-password-grant-0.0.4.tgz","integrity":"sha512-m0P27PL1ROXKPy/kJ03Ts4Abbsawy+Ep2BVwL4eOrlZcoHv3m43QxMaM2lfO+spuMIf2FI013AeRKiVf7pKUgg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJGyiOMiPdjsswuqj1IlkB9LH8Za/Dba9AJBtXiUZVYwIhAKiymlq35oIjHDfB1YuvpA9a5Xc95ZPXK4anwewoW/3m"}]},"maintainers":[{"name":"leftmostcat","email":"leftmostcat@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/passport-oauth2-password-grant-0.0.4.tgz_1464450140799_0.74397725565359"}}},"readme":"# passport-oauth2-password-grant\n\n[![Build](https://travis-ci.org/leftmostcat/passport-oauth2-password-grant.svg?branch=master)](https://travis-ci.org/leftmostcat/passport-oauth2-password-grant)\n[![Quality](https://codeclimate.com/github/leftmostcat/passport-oauth2-password-grant/badges/gpa.svg)](https://codeclimate.com/github/leftmostcat/passport-oauth2-password-grant)\n\nThis module allows authentication through OAuth2 on servers which permit the\n'password' grant type. It makes use of the [Passport](http://passportjs.org/)\nauthentication framework to allow easy use by any\n[Express](http://expressjs.com/)-based application. Like the module on which it\nis based, [passport-oauth2](https://github.com/jaredhanson/passport-oauth2), its\nfunctionality is designed to be generic enough for use with any OAuth2-compliant\nimplementation which accepts password grants and can be subclassed for\nprovider-specific functionality, including user profile.\n\n## Installation\n\n\t$ npm install passport-oauth2-password-grant\n\n## Usage\n\n#### Generic Configuration\n\nLike passport-oauth2, the token grant endpoint and OAuth2 client ID are\npassed as options to the strategy constructor. It also requires a `verify()`\ncallback, which is called when authentication has succeeded and must call the\n`done()` callback when it has finished. `verify()` accepts one of the following\nprototypes:\n\n\tfunction(accessToken, refreshToken, profile, done);\n\tfunction(accessToken, refreshToken, requestParams, profile, done);\n\nThe following demonstrates how to construct and use a PasswordGrantStrategy\nobject:\n\n\tvar PasswordGrantStrategy = require('passport-oauth2-password-grant');\n\n\tpassport.use(new PasswordGrantStrategy({\n\t\ttokenURL: 'https://www.example.com/oauth2/token',\n\t\tclientID: EXAMPLE_CLIENT_ID\n\t},\n\tfunction(accessToken, refreshToken, profile, done) {\n\t\tdone(null, profile);\n\t});\n\nAdditionally, the `passReqToCallback` and `skipUserProfile` options may be used,\nwhich function identically to the same options for passport-oauth2.\n\n#### Authentication\n\nThis is accomplished through the use of `passport.authenticate()` with the\n`password-grant` strategy. The username and password to be used for\nauthentication are to be passed to `passport.authenticate()` as the `username`\nand `password` options, respectively. This may be done as in the following\nexample:\n\n\tfunction authenticate() {\n\t\treturn function(req, res, next) {\n\t\t\tvar username = req.body.username;\n\t\t\tvar password = req.body.password;\n\n\t\t\tpassport.authenticate('password-grant', {\n\t\t\t\tusername: username,\n\t\t\t\tpassword: password\n\t\t\t})(req, res, next);\n\t\t};\n\t}\n\n\tapp.get('/auth/handler', authenticate(), function(req, res) {\n\t\tres.redirect('/');\n\t});\n\n#### User Profile Retrieval\n\nIn order to retrieve profile information for the authenticating user, a subclass\nof PasswordGrantStrategy must be provided which overrides the\n`PasswordGrantStrategy.userProfile()` function with prototype\n`userProfile(accessToken, done)`. `done()` should be called as\n`done(err, profile)`, and `profile` is then passed to the `verify()` callback\nprovided during configuration.\n\n## Related Modules\n\n* [passport-oauth2](https://github.com/jaredhanson/passport-oauth2)\n  – OAuth 2.0 authentication strategy, upon which this module is based\n* [passport-http-bearer](https://github.com/jaredhanson/passport-http-bearer)\n  – Bearer token authentication strategy for APIs\n\n## Testing\n\n\t$ npm install\n\t$ npm test\n\n## Credits\n\n- [Sean Burke](https://github.com/leftmostcat/) — Module author\n- [Jared Hanson](https://github.com/jaredhanson/) – Author of passport-oauth2,\n  from which this module was adapted and upon which this module relies\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n","maintainers":[{"name":"leftmostcat","email":"leftmostcat@gmail.com"}],"time":{"modified":"2022-06-23T13:10:22.064Z","created":"2015-03-09T21:20:55.897Z","0.0.1":"2015-03-09T21:20:55.897Z","0.0.2":"2015-03-11T00:54:17.347Z","0.0.3":"2015-04-11T06:01:16.602Z","0.0.4":"2016-05-28T15:42:22.987Z"},"homepage":"https://github.com/leftmostcat/passport-oauth2-password-grant#readme","keywords":["passport","auth","authn","authentication","authz","authorization","oauth","oauth2","password"],"repository":{"type":"git","url":"git://github.com/leftmostcat/passport-oauth2-password-grant.git"},"author":{"name":"Sean Burke","email":"leftmostcat@gmail.com"},"bugs":{"url":"http://github.com/leftmostcat/passport-oauth2-password-grant/issues"},"readmeFilename":"README.md"}