【发布时间】:2015-01-01 03:53:20
【问题描述】:
我正在关注 scotch.io 提供的 passport.js 身份验证教程,它实际上可以在我的浏览器上运行,但是由于我正在开发 REST API,因此我正在放慢更改某些代码部分的速度,例如不需要 ejs 模块。我正在尝试使用 chrome 的 Postman 和 Basic Auth 为用户注册发布请求,但到目前为止无济于事,身份验证总是失败并重新重定向到注册。这是注册帖子:
app.post('/signup', passport.authenticate('local-signup', {
successRedirect : '/login', // redirect to the secure profile section
failureRedirect : '/signup', // redirect back to the signup page if there is an error
failureFlash : true // allow flash messages
}));
有人可以向我解释为什么它不能处理不是通过 signup.ejs 模板发出的帖子请求,以及如何将 scotch 实现更改为 REST 之类的东西?
【问题讨论】:
标签: node.js rest passport-local passport.js