{"id":13622707,"url":"https://github.com/jaredhanson/passport-oauth2","last_synced_at":"2025-05-14T10:06:35.319Z","repository":{"id":10044195,"uuid":"12090627","full_name":"jaredhanson/passport-oauth2","owner":"jaredhanson","description":"OAuth 2.0 authentication strategy for Passport and Node.js.","archived":false,"fork":false,"pushed_at":"2024-02-28T17:52:26.000Z","size":192,"stargazers_count":612,"open_issues_count":94,"forks_count":347,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-09T05:41:05.806Z","etag":null,"topics":["oauth2","passport"],"latest_commit_sha":null,"homepage":"https://www.passportjs.org/packages/passport-oauth2/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=passport-oauth2\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":"CHANGELOG.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jaredhanson"}},"created_at":"2013-08-13T19:28:58.000Z","updated_at":"2025-04-20T19:48:29.000Z","dependencies_parsed_at":"2024-06-12T06:43:23.621Z","dependency_job_id":"bbce5ca8-0856-4e82-b919-eb3f3dee0aaa","html_url":"https://github.com/jaredhanson/passport-oauth2","commit_stats":{"total_commits":185,"total_committers":16,"mean_commits":11.5625,"dds":0.09189189189189184,"last_synced_commit":"be9bf58cee75938c645a9609f0cc87c4c724e7c8"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fpassport-oauth2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredhanson","download_url":"https://codeload.github.com/jaredhanson/passport-oauth2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254119472,"owners_count":22017951,"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":["oauth2","passport"],"created_at":"2024-08-01T21:01:23.123Z","updated_at":"2025-05-14T10:06:35.296Z","avatar_url":"https://github.com/jaredhanson.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jaredhanson"],"categories":["JavaScript"],"sub_categories":[],"readme":"# passport-oauth2\n\nGeneral-purpose OAuth 2.0 authentication strategy for [Passport](https://www.passportjs.org/).\n\nThis module lets you authenticate using OAuth 2.0 in your Node.js applications.\nBy plugging into Passport, OAuth 2.0-based sign in can be easily and\nunobtrusively integrated into any application or framework that supports\n[Connect](https://github.com/senchalabs/connect#readme)-style middleware, including\n[Express](https://expressjs.com/).\n\nNote that this strategy provides generic OAuth 2.0 support.  In many cases, a\nprovider-specific strategy can be used instead, which cuts down on unnecessary\nconfiguration, and accommodates any provider-specific quirks.  See the\n[list](https://github.com/jaredhanson/passport/wiki/Strategies) for supported\nproviders.\n\nDevelopers who need to implement authentication against an OAuth 2.0 provider\nthat is not already supported are encouraged to sub-class this strategy.  If you\nchoose to open source the new provider-specific strategy, please add it to the\nlist so other people can find it.\n\n\u003cdiv align=\"center\"\u003e\n\n:brain: [Understanding OAuth 2.0](https://www.passportjs.org/concepts/oauth2/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=passport-oauth2\u0026utm_content=nav-concept) •\n:heart: [Sponsors](https://www.passportjs.org/sponsors/?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=passport-oauth2\u0026utm_content=nav-sponsors)\n\n\u003c/div\u003e\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.380582\u0026type=2\u0026murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Flearn-oauth-2%2F\u0026u1=5I2riUEiNIRjPjdjxj6X4exzu3lhRkWY0et6Y8eyT3\"\u003eLearn OAuth 2.0 - Get started as an API Security Expert\u003c/a\u003e\u003cbr\u003eJust imagine what could happen to YOUR professional career if you had skills in OAuth \u003e 8500 satisfied students\n\u003c/p\u003e\n\n---\n\n[![npm](https://img.shields.io/npm/v/passport-oauth2.svg)](https://www.npmjs.com/package/passport-oauth2)\n[![build](https://img.shields.io/travis/jaredhanson/passport-oauth2.svg)](https://travis-ci.org/jaredhanson/passport-oauth2)\n[![coverage](https://img.shields.io/coveralls/jaredhanson/passport-oauth2.svg)](https://coveralls.io/github/jaredhanson/passport-oauth2)\n[...](https://github.com/jaredhanson/passport-oauth2/wiki/Status)\n\n## Install\n\n    $ npm install passport-oauth2\n\n## Usage\n\n#### Configure Strategy\n\nThe OAuth 2.0 authentication strategy authenticates users using a third-party\naccount and OAuth 2.0 tokens.  The provider's OAuth 2.0 endpoints, as well as\nthe client identifer and secret, are specified as options.  The strategy\nrequires a `verify` callback, which receives an access token and profile,\nand calls `cb` providing a user.\n\n```js\npassport.use(new OAuth2Strategy({\n    authorizationURL: 'https://www.example.com/oauth2/authorize',\n    tokenURL: 'https://www.example.com/oauth2/token',\n    clientID: EXAMPLE_CLIENT_ID,\n    clientSecret: EXAMPLE_CLIENT_SECRET,\n    callbackURL: \"http://localhost:3000/auth/example/callback\"\n  },\n  function(accessToken, refreshToken, profile, cb) {\n    User.findOrCreate({ exampleId: profile.id }, function (err, user) {\n      return cb(err, user);\n    });\n  }\n));\n```\n\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'oauth2'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n```js\napp.get('/auth/example',\n  passport.authenticate('oauth2'));\n\napp.get('/auth/example/callback',\n  passport.authenticate('oauth2', { failureRedirect: '/login' }),\n  function(req, res) {\n    // Successful authentication, redirect home.\n    res.redirect('/');\n  });\n```\n\n## Related Modules\n\n- [passport-oauth1](https://github.com/jaredhanson/passport-oauth1) — OAuth 1.0 authentication strategy\n- [passport-http-bearer](https://github.com/jaredhanson/passport-http-bearer) — Bearer token authentication strategy for APIs\n- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) — OAuth 2.0 authorization server toolkit\n\n## Contributing\n\n#### Tests\n\nThe test suite is located in the `test/` directory.  All new features are\nexpected to have corresponding test cases.  Ensure that the complete test suite\npasses by executing:\n\n```bash\n$ make test\n```\n\n#### Coverage\n\nAll new feature development is expected to have test coverage.  Patches that\nincrese test coverage are happily accepted.  Coverage reports can be viewed by\nexecuting:\n\n```bash\n$ make test-cov\n$ make view-cov\n```\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2011-2016 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","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredhanson%2Fpassport-oauth2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhanson%2Fpassport-oauth2/lists"}