I'm using Feathers framework to my nodejs application and i have done creation of jwt in following way
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')
]
}
});
now i have doubt how to get userId from token using jwt decoded data.