{"id":18665320,"url":"https://github.com/robertklep/passport-request","last_synced_at":"2026-04-29T22:33:16.301Z","repository":{"id":57320276,"uuid":"60690874","full_name":"robertklep/passport-request","owner":"robertklep","description":"Request authentication strategy for Passport","archived":false,"fork":false,"pushed_at":"2016-06-08T10:53:36.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T02:43:08.369Z","etag":null,"topics":["authentication","node","passport"],"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/robertklep.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":"2016-06-08T10:47:53.000Z","updated_at":"2016-06-08T10:48:26.000Z","dependencies_parsed_at":"2022-08-26T01:10:37.496Z","dependency_job_id":null,"html_url":"https://github.com/robertklep/passport-request","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/robertklep%2Fpassport-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertklep%2Fpassport-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertklep%2Fpassport-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertklep%2Fpassport-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertklep","download_url":"https://codeload.github.com/robertklep/passport-request/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239492596,"owners_count":19647993,"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":["authentication","node","passport"],"created_at":"2024-11-07T08:27:11.618Z","updated_at":"2025-11-06T10:30:41.377Z","avatar_url":"https://github.com/robertklep.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# passport-request\n\n[Passport](http://passportjs.org/) strategy for authenticating against\nExpress' [`request`](http://expressjs.com/en/4x/api.html#req) object.\n\n## Install\n\n```bash\n$ npm install passport-request\n```\n\n## Usage\n\n#### Configure Strategy\n\nThe strategy requires a `verify` callback, which gets passed the request object and a `done` callback that should be called with the results of the authentication.\n\nFor example, to allow authentication using `POST /login/:username` and a `password` parameter in the request body:\n\n```js\nvar RequestStrategy = require('passport-request').Strategy;\n\npassport.use(new RequestStrategy(function(req, done) {\n  var username = req.params.username;\n  var password = req.body.password;\n  User.findOne({ username : username }, function (err, user) {\n    if (err) {\n      return done(err);\n    } else if (! user) {\n      return done(null, false);\n    } else if (! user.verifyPassword(password)) {\n      return done(null, false);\n    } else {\n      return done(null, user);\n    }\n  });\n));\n```\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'request'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n```js\napp.post('/login/:username',\n  passport.authenticate('request', { failureRedirect: '/login' }),\n  function(req, res) {\n    res.redirect('/');\n  }\n);\n```\n\n## Credits\n\n- [Robert Klep](http://github.com/robertklep)\n- [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertklep%2Fpassport-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertklep%2Fpassport-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertklep%2Fpassport-request/lists"}