Gathering detailed insights and metrics for passport-google-oauth20-without-google-plus
Gathering detailed insights and metrics for passport-google-oauth20-without-google-plus
Gathering detailed insights and metrics for passport-google-oauth20-without-google-plus
Gathering detailed insights and metrics for passport-google-oauth20-without-google-plus
npm install passport-google-oauth20-without-google-plus
Typescript
Module System
Min. Node Version
Node Version
NPM Version
69.3
Supply Chain
90.5
Quality
74.9
Maintenance
100
Vulnerability
99.6
License
JavaScript (98.32%)
Makefile (1.68%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
6,442
Last Day
1
Last Week
13
Last Month
44
Last Year
309
MIT License
1 Stars
33 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Mar 07, 2019
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
passport-google-oauth20-without-google-plus@1.0.1
Unpacked Size
48.01 kB
Size
12.47 kB
File Count
25
NPM Version
6.4.1
Node Version
10.15.0
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
8.3%
13
Compared to previous week
Last Month
175%
44
Compared to previous month
Last Year
48.6%
309
Compared to previous year
1$ npm install @passport-next/passport-google-oauth2
Before using @passport-next/passport-google-oauth2
, you must register an application with
Google. If you have not already done so, a new project can be created in the
Google Developers Console.
Your application will be issued a client ID and client secret, which need to be
provided to the strategy. You will also need to configure a redirect URI which
matches the route in your application.
The Google authentication strategy authenticates users using a Google account
and OAuth 2.0 tokens. The client ID and secret obtained when creating an
application are supplied as options when creating the strategy. The strategy
also requires a verify
callback, which receives the access token and optional
refresh token, as well as profile
which contains the authenticated user's
Google profile. The verify
callback must call cb
providing a user to
complete authentication.
1var GoogleStrategy = require('@passport-next/passport-google-oauth2').Strategy; 2 3passport.use(new GoogleStrategy({ 4 clientID: GOOGLE_CLIENT_ID, 5 clientSecret: GOOGLE_CLIENT_SECRET, 6 callbackURL: "http://www.example.com/auth/google/callback" 7 }, 8 function(accessToken, refreshToken, profile, cb) { 9 User.findOrCreate({ googleId: profile.id }, function (err, user) { 10 return cb(err, user); 11 }); 12 } 13));
Use passport.authenticate()
, specifying the 'google'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
1app.get('/auth/google', 2 passport.authenticate('google', { scope: ['profile'] })); 3 4app.get('/auth/google/callback', 5 passport.authenticate('google', { failureRedirect: '/login' }), 6 function(req, res) { 7 // Successful authentication, redirect home. 8 res.redirect('/'); 9 });
Developers using the popular Express web framework can refer to an example as a starting point for their own web applications. The example shows how to authenticate users using Facebook. However, because both Facebook and Google use OAuth 2.0, the code is similar. Simply replace references to Facebook with corresponding references to Google.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 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 SAST tool detected
Details
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
20 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-10
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