-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] How to add userId for each authenticated request #433
Comments
Hi, for such purpose I've created this library, because nest doesn't have guarantee of modules registration and middlewares order, you can see discussion for same problem of middlewares order in another my package. All you need is wrap this module in another one with extra decorator, and add one to your passport/auth/whatever module. and the second part is you need to find specific option to add new properties to logs Feel free to ping me with your code exmaples |
Did you manage to find a solution for this? |
I haven't tried yet what iamolegga suggested, but I will do it as soon as possible and I will let you know. |
I was unable to do it with My solution to this problem is to use the |
@vladiulianbogdan can you share snippet how you resolved that issue with decorators pls? |
Hello,
I am using your library in my project. Thanks for your work, it is really helpful!
We are using a Passport local strategy for authentication (https://docs.nestjs.com/security/authentication#implementing-passport-local). If the authentication is performed correctly, the
user
object will be added on therequest
object that it will be later passed to the controllers.What I would like to do is to add the
userId
value to each request information that is bundled together with each log. It seems that the serializer methods are called before this auth layer is called and I did not find a way to do this in the documentation.Do you have any advice on how to implement this?
Thank you!
The text was updated successfully, but these errors were encountered: