node.js - Passport authentication not working in sails.js application -


i have sails js application. trying setup authentication using passport.js authentication layer sails-generate-auth. have configured app following steps given in documentation.

but when lift sails app, authentication not working. able access controllers, when not logged in (it's not redirecting login page).

i added console.log statement in api/policies/passport.js follows:

module.exports = function (req, res, next) {   passport.initialize()(req, res, function () {     passport.session()(req, res, function () {       res.locals.user = req.user;       console.log(req.user); // added me       next();      });   }); }; 

now, when access controllers before login or after logout, printing undefined. when logged in, printing user data. idea why not checking authentication?

i using local authentication strategy , have commented out others (twitter, facebook...)

passport doesn't have policy deny access controller. this, have create policy.

see link more details.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -