16/11/2018 Development / java script

this hook return user in authentication with accessToken  

app.service('authentication').hooks({
    before: {
      create: [
        authentication.hooks.authenticate(config.strategies)
      ],
      remove: [
        authentication.hooks.authenticate('jwt')
      ]
    },
    after: {
      create: [

        iff(context => (context.params && context.params.headers), (context) => {
          const { app } = context;
          const config = app.get('authentication');
          const result = context.result;

          result.user = context.params.user;

          return context;
        })

      ]
    }
  });