What Is "done" Callback Function In Passport Strategy Configure "use" Function
I'm an node.js and express.js noob. This question may seems silly but I'm really in confusion. I'm trying to configure Local Strategry authentication by using passport. As shown in
Solution 1:
done
is a method called internally by the strategy implementation.
Then it navigates you, as you can see, to one of the success
/ error
/ fail
methods (again, by the implementation. there are more options).
Each of these options may calls to the next
, where in your snippet code is the following:
function(req, res) {
res.redirect('/');
});
When success
is called, it can attach the user to the request or do other things, depending on your needs (it looks for the options
you pass to passport.authenticate
). If you want to determine when next
will be called, you should use custom callback
which gives you more flexibility.
I strongly recommend that you read the source.
Post a Comment for "What Is "done" Callback Function In Passport Strategy Configure "use" Function"