Created
February 28, 2014 13:38
-
-
Save nkbt/9271261 to your computer and use it in GitHub Desktop.
Passport.js usage example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ar TwitterStrategy = require('passport-twitter').Strategy; | |
var FacebookStrategy = require('passport-facebook').Strategy; | |
var LinkedinStrategy = require('passport-linkedin').Strategy; | |
var passport = require('passport'); | |
var _ = require('underscore'); | |
var configurable = require('configurable-module'); | |
function configure(options) { | |
if (!_.isEmpty(options.apps.twitter)) { | |
passport.use(new TwitterStrategy(_.extend(options.apps.twitter, {passReqToCallback: true}), options.userHandler)); | |
} | |
if (!_.isEmpty(options.apps.linkedin)) { | |
passport.use(new LinkedinStrategy(_.extend(options.apps.linkedin, {passReqToCallback: true}), options.userHandler)); | |
} | |
if (!_.isEmpty(options.apps.facebook)) { | |
passport.use(new FacebookStrategy(_.extend(options.apps.facebook, {passReqToCallback: true}), options.userHandler)); | |
} | |
passport.serializeUser(options.serializeUser); | |
passport.deserializeUser(options.deserializeUser); | |
return passport; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment