我正在學習passportjs。我在這裏 https://github.com/jaredhanson/passport-google/blob/master/examples/signon/app.js爲什麼passport.authenticate調用了兩次?
看護照,谷歌例如它包含以下幾行代碼
app.get('/auth/google',
passport.authenticate('google', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
});
而隨後,這些線路:
app.get('/auth/google/return',
passport.authenticate('google', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
});
有人可以幫助我瞭解爲什麼需要重複調用passport.authenticate?