Gathering detailed insights and metrics for passport-oauth2
Gathering detailed insights and metrics for passport-oauth2
Gathering detailed insights and metrics for passport-oauth2
Gathering detailed insights and metrics for passport-oauth2
passport-google-oauth2
Passport strategy for Google OAuth 2.0
passport-oauth2-refresh
A passport.js add-on to provide automatic OAuth 2.0 token refreshing.
@types/passport-oauth2
TypeScript definitions for passport-oauth2
passport-oauth
OAuth 1.0 and 2.0 authentication strategies for Passport.
OAuth 2.0 authentication strategy for Passport and Node.js.
npm install passport-oauth2
Typescript
Module System
Min. Node Version
Node Version
NPM Version
82.6
Supply Chain
98.6
Quality
76.3
Maintenance
100
Vulnerability
100
License
JavaScript (99.95%)
Makefile (0.05%)
Total Downloads
140,783,324
Last Day
36,413
Last Week
481,557
Last Month
2,820,546
Last Year
33,374,945
608 Stars
206 Commits
345 Forks
16 Watching
7 Branches
13 Contributors
Minified
Minified + Gzipped
Latest Version
1.8.0
Package Id
passport-oauth2@1.8.0
Unpacked Size
35.70 kB
Size
9.89 kB
File Count
15
NPM Version
9.8.0
Node Version
20.5.1
Publised On
02 Feb 2024
Cumulative downloads
Total Downloads
Last day
-72%
36,413
Compared to previous day
Last week
-29.3%
481,557
Compared to previous week
Last month
-5.8%
2,820,546
Compared to previous month
Last year
10.2%
33,374,945
Compared to previous year
5
5
General-purpose OAuth 2.0 authentication strategy for Passport.
This module lets you authenticate using OAuth 2.0 in your Node.js applications. By plugging into Passport, OAuth 2.0-based sign in can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
Note that this strategy provides generic OAuth 2.0 support. In many cases, a provider-specific strategy can be used instead, which cuts down on unnecessary configuration, and accommodates any provider-specific quirks. See the list for supported providers.
Developers who need to implement authentication against an OAuth 2.0 provider that is not already supported are encouraged to sub-class this strategy. If you choose to open source the new provider-specific strategy, please add it to the list so other people can find it.
:brain: Understanding OAuth 2.0 • :heart: Sponsors
Advertisement
Learn OAuth 2.0 - Get started as an API Security Expert
Just imagine what could happen to YOUR professional career if you had skills in OAuth > 8500 satisfied students
$ npm install passport-oauth2
The OAuth 2.0 authentication strategy authenticates users using a third-party
account and OAuth 2.0 tokens. The provider's OAuth 2.0 endpoints, as well as
the client identifer and secret, are specified as options. The strategy
requires a verify
callback, which receives an access token and profile,
and calls cb
providing a user.
1passport.use(new OAuth2Strategy({
2 authorizationURL: 'https://www.example.com/oauth2/authorize',
3 tokenURL: 'https://www.example.com/oauth2/token',
4 clientID: EXAMPLE_CLIENT_ID,
5 clientSecret: EXAMPLE_CLIENT_SECRET,
6 callbackURL: "http://localhost:3000/auth/example/callback"
7 },
8 function(accessToken, refreshToken, profile, cb) {
9 User.findOrCreate({ exampleId: profile.id }, function (err, user) {
10 return cb(err, user);
11 });
12 }
13));
Use passport.authenticate()
, specifying the 'oauth2'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
1app.get('/auth/example', 2 passport.authenticate('oauth2')); 3 4app.get('/auth/example/callback', 5 passport.authenticate('oauth2', { failureRedirect: '/login' }), 6 function(req, res) { 7 // Successful authentication, redirect home. 8 res.redirect('/'); 9 });
The test suite is located in the test/
directory. All new features are
expected to have corresponding test cases. Ensure that the complete test suite
passes by executing:
1$ make test
All new feature development is expected to have test coverage. Patches that increse test coverage are happily accepted. Coverage reports can be viewed by executing:
1$ make test-cov 2$ make view-cov
Copyright (c) 2011-2016 Jared Hanson <http://jaredhanson.net/>
Stable Version
1
5.3/10
Summary
Improper Access Control in passport-oauth2
Affected Versions
< 1.6.1
Patched Versions
1.6.1
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
8 existing vulnerabilities detected
Details
Reason
Found 2/21 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More