I've created an authentication using feathers generate authentication
and a service that requires authentication using feathers generate service
.
I haven't done any code changes to this at all.
So I have the following:
app.service('authentication').hooks({
before: {
create: [
authentication.hooks.authenticate(config.strategies)
],
remove: [
authentication.hooks.authenticate('jwt')
]
}
});
I was wondering how, after a successful authentication of the JWT token, how can I get that object into my services constructor?
In my service I have:
module.exports = {
before: {
all: [
authenticate('jwt'),
hook => { console.log(hook.params.payload); }
],
Which console logs the payload but I just don't know how to actually save it so my service can access it.
I realized if you look at the params
it's in there.
class Service {
constructor (options) {
this.options = options || {};
}
async find (params) {
console.log(params);
..
.