Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 身份验证后获取JWT对象_Javascript_Node.js_Jwt_Feathersjs - Fatal编程技术网

Javascript 身份验证后获取JWT对象

Javascript 身份验证后获取JWT对象,javascript,node.js,jwt,feathersjs,Javascript,Node.js,Jwt,Feathersjs,我已经使用feathers generate authentication创建了一个身份验证,并使用feathers generate service创建了一个需要身份验证的服务 我根本没有对这个做任何代码更改 因此,我有以下几点: app.service('authentication').hooks({ before: { create: [ authentication.hooks.authenticate(config.strategies) ],

我已经使用
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); } 
    ],

哪个控制台记录有效负载,但我不知道如何实际保存它,以便我的服务可以访问它。

我意识到,如果您查看
参数,它就在那里

class Service {

  constructor (options) {
    this.options = options || {};
  }

  async find (params) {

    console.log(params);
  ..
  .