【发布时间】:2017-09-28 00:56:36
【问题描述】:
我在我的 nodejs 应用程序中使用 Feathers 框架,并且我已经按照以下方式创建了 jwt
app.service('authentication').hooks({
before: {
create: [
authentication.hooks.authenticate(config.strategies),
function (hook) {
hook.params.payload = {
userId: hook.params.user.userId,
accountId: hook.params.user.accountId
};
return Promise.resolve(hook);
}
],
remove: [
authentication.hooks.authenticate('jwt')
]
}
});
现在我怀疑如何使用 jwt 解码数据从令牌中获取 userId。
【问题讨论】:
标签: javascript node.js jwt decode feathersjs