I found that done() method (or success(), as told by my debugger) has a third argument as well which is called info. Can anybody tell me what happens to value passed into it?
EDIT
The done() method I am referring to is the one we have to call in a strategy callback. e.g.
var passport = require('passport')
, LocalStrategy = require('passport-local').Strategy;
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) {
return done(null, false, { message: 'Incorrect username.' });
}
if (!user.validPassword(password)) {
return done(null, false, { message: 'Incorrect password.' });
}
return done(null, user);
});
}
));
The snippet is from here. As it can be seen, in some cases, a message is being passed in an object as third argument to done(). How can we access this message in a route method?
You should be able to access the information passed as the third parameter as
req.authInfo.You can see the processing here as
info, where it is assigned toauthInfoand used for flash messages.