I find passport-facebook quite simple and useful.
I also like that the main passport module has 80+ authentication strategies.
(e.g. twitter, google, foursquare, github, digg, dropbox).
From the creator of github README:
// Set up the strategy passport.use(new FacebookStrategy({ clientID: FACEBOOK_APP_ID, clientSecret: FACEBOOK_APP_SECRET, callbackURL: "http://localhost:3000/auth/facebook/callback" }, function(accessToken, refreshToken, profile, done) { User.findOrCreate({ facebookId: profile.id }, function (err, user) { return done(err, user); }); } )); // Use the authentication app.get('/auth/facebook', passport.authenticate('facebook'), function(req, res){ // The request will be redirected to Facebook for authentication, so // this function will not be called. }); app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/login' }), function(req, res) { // Successful authentication, redirect home. res.redirect('/'); });
treejanitor Feb 08 '13 at 10:23 2013-02-08 10:23
source share