Installations
npm install passport-google-oauth20-without-google-plus
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=6
Node Version
10.15.0
NPM Version
6.4.1
Score
69.3
Supply Chain
90.5
Quality
74.9
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (98.32%)
Makefile (1.68%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
himanshu0511
Download Statistics
Total Downloads
6,442
Last Day
1
Last Week
13
Last Month
44
Last Year
309
GitHub Statistics
MIT License
1 Stars
33 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Mar 07, 2019
Bundle Size
92.47 kB
Minified
31.99 kB
Minified + Gzipped
Package Meta Information
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
Total Downloads
Cumulative downloads
Total Downloads
6,442
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Passport strategy for Google OAuth 2.0
Install
1$ npm install @passport-next/passport-google-oauth2
Usage
Create an Application
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.
Configure Strategy
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));
Authenticate Requests
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 });
Examples
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
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
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
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
20 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-6chw-6frg-f759
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-3gx7-xhv7-5mx3
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
Score
1.7
/10
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