Wednesday, 15 March 2017

what are the 2 routes for Facebook authentication with passport

what's the point having the passport.authenticate("facebook") on both routes in the typical example below.

/auth/facebook what actually happens here? does facebook detect this route? and what does it do?

/auth/facebook/callback is the one that you give to facebook to redirect to with the user profile information.

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

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



via jack blank

No comments:

Post a Comment