MolecularJS :: Correlation details :: how to pass logged in user to action method

57 Views Asked by At

I am new to molecular Js, can someone please help me in understanding ,how to pass the context of current request in action handlers?

to be more specific, In authenticate method of API gateway I am validating token and decoding it. and I need this decoded token object in action handler methods.

I have tried with ctx.meta , but getting null when i try to accessed it action handler.

Thanks in advance.

1

There are 1 best solutions below

0
On

I was just updating the property in authenticate method.

ctx.meta.user = myUserObject;

But actually, we should return a Promise with resolution.

return Promise.resolve(myUserObject);

it automatically sets the ctx.meta.user with myUserObject