I've used PassportJS within SailsJS v0.9.x and it worked flawlessly. Now updated to v0.1 and passportJS doesnt seem it work.
What I've done in http.js:
passportInit: require('passport').initialize(),
And added passportInit to the middleware list.
I've defined my BasicStrategy like:
passport.use(new BasicStrategy(
function(email, password, next) {
// does not get called nor does it throw an error
}
));
I'm calling this strategy with:
passport.authenticate('basic', {session: false}, function(err, user, info) {
// ...
});
This does not return an error. It does return a nil user. Also when I remove this new BasicStrategy, it does throw an error that strategy Basic is not defined.
Anyone ideas?
I am facing same issue with SailsJS with PassportJS. I solved it by this way :-
someCtrl: function(req, res, next) {
passport.authenticate('basic', {session: false}, function(err, user, info) {
// ...
})(req, res, next);
}