0
我是Passport的新手,我发送的电子邮件和密码为{“email”:“[email protected]”,“password”:“xxx”}作为服务器的请求主体。在服务器端,我利用passportJS的为https://github.com/jaredhanson/passport-local#available-options一样,(AngularJS +护照)用户身份验证
passport.use(new LocalStrategy(
{usernameField: 'email',
passwordField: 'password',
passReqToCallback: true
},
function(req,username,password,done){
console.log("am here");
var x=req.body;
var email=x.email;
var password=x.password;
console.log(x.email);
}
))
app.post('/loginUser',passport.authenticate('local'),function(req,res){
var x=req.body;
db.users.findOne({"email":x.email,"password":x.password},function(err,user){
res.json(user)
})
});
本地策略没有得到accessed.The应用程序崩溃,我只得到类型错误:LocalStrategy需要验证回调。请让我知道我出错的地方
这确实是一个很好的建议兰斯,但我仍然得到同样的类型错误。我已经更新了同样的问题。请让我知道我出错的地方。 – Gayathri
嗨错误是在我的方面进口包。感谢您的答复。 – Gayathri