{"id":28076798,"url":"https://github.com/jaredhanson/passport-oauth2-client-password","last_synced_at":"2025-05-13T01:52:08.009Z","repository":{"id":3882553,"uuid":"4969421","full_name":"jaredhanson/passport-oauth2-client-password","owner":"jaredhanson","description":"OAuth 2.0 client password authentication strategy for Passport and Node.js.","archived":false,"fork":false,"pushed_at":"2020-07-06T18:53:07.000Z","size":18,"stargazers_count":96,"open_issues_count":4,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T21:10:45.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.passportjs.org/packages/passport-oauth2-client-password/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=passport-oauth2-client-password\u0026utm_content=about","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredhanson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"jaredhanson","ko_fi":"jaredhanson"}},"created_at":"2012-07-10T05:28:10.000Z","updated_at":"2022-11-08T23:32:19.000Z","dependencies_parsed_at":"2022-08-02T10:35:28.203Z","dependency_job_id":null,"html_url":"https://github.com/jaredhanson/passport-oauth2-client-password","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2-client-password","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2-client-password/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2-client-password/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2-client-password/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredhanson","download_url":"https://codeload.github.com/jaredhanson/passport-oauth2-client-password/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856618,"owners_count":21974576,"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":"2025-05-13T01:52:07.425Z","updated_at":"2025-05-13T01:52:08.001Z","avatar_url":"https://github.com/jaredhanson.png","language":"JavaScript","funding_links":["https://patreon.com/jaredhanson","https://ko-fi.com/jaredhanson"],"categories":[],"sub_categories":[],"readme":"# passport-oauth2-client-password\n\nOAuth 2.0 client password authentication strategy for [Passport](https://github.com/jaredhanson/passport).\n\nThis module lets you authenticate requests containing client credentials in the\nrequest body, as [defined](http://tools.ietf.org/html/draft-ietf-oauth-v2-27#section-2.3.1)\nby the OAuth 2.0 specification.  These credentials are typically used protect\nthe token endpoint and used as an alternative to HTTP Basic authentication.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003csup\u003eAdvertisement\u003c/sup\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://click.linksynergy.com/link?id=D*o7yui4/NM\u0026offerid=507388.2609434\u0026type=2\u0026murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Fnodejs-api-masterclass%2F\u0026u1=Ius3vVkJ3XVRPjqYb7g5YZNfcwKVDaXt4Y3yy6cQe6YnPBuctE4XdNGVXalQgXP\"\u003eNode.js API Masterclass With Express \u0026 MongoDB\u003c/a\u003e\u003cbr\u003eCreate a real world backend for a bootcamp directory app\n\u003c/p\u003e\n\n---\n\n[![npm](https://img.shields.io/npm/v/passport-oauth2-client-password.svg)](https://www.npmjs.com/package/passport-oauth2-client-password)\n[![build](https://img.shields.io/travis/jaredhanson/passport-oauth2-client-password.svg)](https://travis-ci.org/jaredhanson/passport-oauth2-client-password)\n[![coverage](https://img.shields.io/coveralls/jaredhanson/passport-oauth2-client-password.svg)](https://coveralls.io/github/jaredhanson/passport-oauth2-client-password)\n[...](https://github.com/jaredhanson/passport-oauth2-client-password/wiki/Status)\n\n## Install\n\n```sh\n$ npm install passport-oauth2-client-password\n```\n\n## Usage\n\n#### Configure Strategy\n\nThe OAuth 2.0 client password authentication strategy authenticates clients\nusing a client ID and client secret.  The strategy requires a `verify` callback,\nwhich accepts those credentials and calls `done` providing a client.\n\n```js\npassport.use(new ClientPasswordStrategy(\n    function(clientId, clientSecret, done) {\n    Clients.findOne({ clientId: clientId }, function (err, client) {\n      if (err) { return done(err); }\n      if (!client) { return done(null, false); }\n      if (client.clientSecret != clientSecret) { return done(null, false); }\n      return done(null, client);\n    });\n  }\n));\n```\n\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'oauth2-client-password'`\nstrategy, to authenticate requests.  This strategy is typically used in\ncombination with HTTP Basic authentication (as provided by [passport-http](https://github.com/jaredhanson/passport-http)),\nallowing clients to include credentials in the request body.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication, using [OAuth2orize](https://github.com/jaredhanson/oauth2orize)\nmiddleware to implement the token endpoint:\n\n```\napp.get('/profile', \n  passport.authenticate(['basic', 'oauth2-client-password'], { session: false }),\n  oauth2orize.token());\n```\n\n## Examples\n\nThe [example](https://github.com/jaredhanson/oauth2orize/tree/master/examples/express2)\nincluded with [OAuth2orize](https://github.com/jaredhanson/oauth2orize)\ndemonstrates how to implement a complete OAuth 2.0 authorization server.\n`ClientPasswordStrategy` is used to authenticate clients as they request access\ntokens from the token endpoint.\n\n## Tests\n\n```sh\n$ npm install --dev\n$ make test\n```\n\n## Credits\n\n  - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2012-2013 Jared Hanson \u003c[http://jaredhanson.net/](http://jaredhanson.net/)\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhanson%2Fpassport-oauth2-client-password","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredhanson%2Fpassport-oauth2-client-password","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhanson%2Fpassport-oauth2-client-password/lists"}