im尝试使用feathersJS创建身份验证。即时消息并不存在,他们从一开始就手动创建了服务,这意味着他们没有使用“羽毛生成服务”命令,现在,一切正常。但是现在他们希望我对他们的登录进行身份验证,我在文档中看到了一些示例,我必须像这样将其放入default.json
"authentication": {
"entity": null,
"service": "users",
"secret": "fhaCVRbeGa0XDMcxRKcnTMz/Ti8=",
"authStrategies": [
"jwt",
"local"
],
"jwtOptions": {
"header": {
"typ": "access"
},
"audience": "https://yourdomain.com",
"issuer": "feathers",
"algorithm": "HS256",
"expiresIn": "1d"
},
"local": {
"usernameField": "userName",
"passwordField": "password"
}
}
所以我的第一个问题是这个。我应该在哪里得到那个实体?那是名字吗?或必须为此存在一个文件? 谢谢
答案 0 :(得分:0)
感谢您的帮助,我已经使用您的帮助解决了它,我也注意到我还没有包括.hooks文件,谢谢 像这样的东西
before: {
all: [],
find: [ authenticate('jwt') ],
get: [ authenticate('jwt') ],
create: [ hashPassword('password') ],
update: [ hashPassword('password'), authenticate('jwt') ],
patch: [ hashPassword('password'), authenticate('jwt') ],
remove: [ authenticate('jwt') ],
},