我正在尝试使用@feathersjs/authentication-local对用户进行身份验证,尽管我给出了正确的用户名和密码,但我得到了以下响应
{
"name": "BadRequest",
"message": "Missing credentials",
"code": 400,
"className": "bad-request",
"data": {
"message": "Missing credentials"
},
"errors": {}
}user实体的DB属性为username & password。我的配置如下
const settings = {
secret: 'super&secret',
usernameField: 'username',
passwordField: 'password',
entityUsernameField: 'username',
entityPasswordField: 'password'
};
app.configure(authentication(settings))
.configure(local());
app.service('authentication').hooks({
before: {
create: [authentication.hooks.authenticate(['local', 'jwt'])],
remove: [],
}
});我已经在请求正文中添加了"strategy": "local"。我遗漏了什么?请帮帮忙。
发布于 2018-04-30 02:29:09
这通常发生在没有注册Express bodyParser中间件的情况下。如feathers-chat所示,它必须是set up before authentication。
发布于 2018-07-10 19:38:39
缺少凭据feathersjs身份验证-本地,可能由于以下原因而发生此错误:
https://stackoverflow.com/questions/50084624
复制相似问题