Passport Google

Google (OpenID) authentication strategy for Passport and Node.js.
Alternatives To Passport Google
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Passport21,42381,2723,916a month ago32May 20, 2022364mitJavaScript
Simple, unobtrusive authentication for Node.js.
Node Express Realworld Example App3,434
14 months ago1June 28, 201873JavaScript
Passport Local2,63754,8811,8316 months ago8March 08, 201457mitJavaScript
Username and password authentication strategy for Passport and Node.js.
Permit1,664847 months ago8July 17, 20188mitJavaScript
An unopinionated authentication library for building Node.js APIs.
Nextjs Starter1,294
3 years ago34iscJavaScript
A starter project for Next.js with authentication
Passport Facebook1,27720,701513a month ago15January 22, 2019126mitJavaScript
Facebook authentication strategy for Passport and Node.js.
Nextjs Mongodb App1,164
a year ago16mitJavaScript
A Next.js and MongoDB web application, designed with simplicity for learning and real-world applicability in mind.
Passport Http Bearer9384,4284326 months ago7August 02, 201317mitJavaScript
HTTP Bearer authentication strategy for Passport and Node.js.
Passport Saml8123141007 days ago65January 21, 202243mitTypeScript
SAML 2.0 authentication with Passport
Koa Passport7731,0561494 months ago39March 11, 202110mitJavaScript
Passport middleware for Koa
Alternatives To Passport Google
Select To Compare


Alternative Project Comparisons
Readme

** NOTICE: Google no-longer supports OpenID 2, and this plugin is no longer functional. Please use Passport-Google-OAuth instead. **

** For more information, see the Google OpenID 2 shutdown timetable. **

Passport-Google

Passport strategy for authenticating with Google using OpenID 2.0.

This module lets you authenticate using Google in your Node.js applications. By plugging into Passport, Google authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

Install

$ npm install passport-google

Usage

Configure Strategy

The Google authentication strategy authenticates users using a Google account, which is also an OpenID 2.0 identifier. The strategy requires a validate callback, which accepts this identifier and calls done providing a user. Additionally, options can be supplied to specify a return URL and realm.

passport.use(new GoogleStrategy({
    returnURL: 'http://localhost:3000/auth/google/return',
    realm: 'http://localhost:3000/'
  },
  function(identifier, done) {
    User.findByOpenID({ openId: identifier }, function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

Use passport.authenticate(), specifying the 'google' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/google',
  passport.authenticate('google'));

app.get('/auth/google/return', 
  passport.authenticate('google', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Examples

For a complete, working example, refer to the signon example.

Tests

$ npm install --dev
$ make test

Build Status

Credits

License

The MIT License

Copyright (c) 2011-2013 Jared Hanson <http://jaredhanson.net/>

Sponsor

Popular Passport Projects
Popular Authentication Projects
Popular Security Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Google
Authentication
Passport
Openid