November 2013
Intermediate to advanced
148 pages
3h 12m
English
Passport is an Express plug-in that provides middleware for a variety of third-party logins. Using passport you can unobtrusively add support for logging in with Twitter, Facebook, and other services.
We’re going to use passport to support authentication with Google credentials. Go get the passport and passport-google modules from npm if you don’t have them already (npm install --save passport passport-google).
To add passport, first add this to your const declarations at the top of your server.js file:
| web-app/b4/server.js | |
| | passport = require('passport'), |
| | GoogleStrategy = require('passport-google').Strategy; |
Then you need to initialize the passport middleware. Add this right after app.use(express.session...) ...
Read now
Unlock full access