configurationPassport接受无身体请求?

我试图设置一个LocalStrategy的可能性login没有凭据在请求正文给出

app.post('/signin', passport.authenticate('local-signin', {failureFlash : true}), function (req, res) { res.send(req.user); }); 

这是战略:

 passport .use('local-signin', new LocalStrategy({ usernameField : 'email', passwordField : 'password', passReqToCallback : true }, function (req, email, password, done) { if (email.length > 0 && password.legnth > 0) { /** Do some stuff with credentials **/ } else { console.log('method2'); /** Other method to log in with request headers...**/ } }); 

不幸的是,当我发送一个请求到/signin无身体/signin ,我有一个状态400错误,并没有加载策略(在这个例子中我没有方法2写在控制台)。

有没有办法configurationPassport接受请求,而没有身体?

有关信息,我使用AngularJS前端,请求$http.post('/signin');

护照版本: 0.2.1

护照本地版本: 1.0.0

包裹passport.authenticate在另一个这样的内部validation中间件

 app.post('/signin', myPass, function(req,res){res.send(req.user)}); function myPass(req, res, next){ // do your thing passport.authenticate('local-signin', {failureFlash : true})(req, res, next); // ^ this returns a middleware that you gotta call here now ^ }