javascript - What does passport authenticate do on callback? -
i using passport js in express project. first route below goes , creates user in db , returns second callback route.
what passport.authenticate('facebook'... ) doing in callback router?
if i using in restful api (no session), can leave out passport.authenticate in callback?
app.get('/auth/facebook', passport.authenticate('facebook')); app.get('/auth/facebook/callback', passport.authenticate('facebook', { successredirect: '/', failureredirect: '/login' }));
what passport.authenticate('facebook'... ) doing in callback router?
that required facebook redirect user after approval. if remove that, after user authenticate facebook there won't redirected site and/or user authenticating see error.
if i using in restful api (no session), can leave out passport.authenticate in callback?
according passport.js documentation if wish facebook authentication need following routes:
//to send user facebook app.get('/auth/facebook', passport.authenticate('facebook')); //this facebook return user token, refreshtoken, profile app.get('/auth/facebook/callback', passport.authenticate('facebook', { successredirect: '/', failureredirect: '/login' })); what passport authenticate on callback?
the verify callback facebook authentication accepts accesstoken, refreshtoken, , profile arguments. profile contain user profile information provided facebook.
the passport.js documentation source of how things work. there tutorials show how fb authentication workflow take place.
Comments
Post a Comment