【发布时间】:2018-06-17 09:28:39
【问题描述】:
我创建了一个使用feathers generate authentication 的身份验证和一个需要使用feathers generate service 进行身份验证的服务。
我根本没有对此进行任何代码更改。
所以我有以下内容:
app.service('authentication').hooks({
before: {
create: [
authentication.hooks.authenticate(config.strategies)
],
remove: [
authentication.hooks.authenticate('jwt')
]
}
});
我想知道,在成功验证 JWT 令牌之后,如何将该对象放入我的服务构造函数中?
在我的服务中,我有:
module.exports = {
before: {
all: [
authenticate('jwt'),
hook => { console.log(hook.params.payload); }
],
哪个控制台记录了负载,但我只是不知道如何实际保存它以便我的服务可以访问它。
【问题讨论】:
标签: javascript node.js jwt feathersjs