You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Inside my usecase, I don't have access to the req.user data, I only have access to them inside the authorize function, and most apis that use express, make use of various data that comes from within the req.user, not just from req.body.
Describe the solution you'd like
The default controller receives the req from express, and passes the req.user to the usecase authorize function, so I can make the proper assertion on the user, the req.user comes from some express middleware that was configured by the developer.
However, many express APIs use other data from req.user, like an id for example, instead of receiving the user's id in the request, it is simply received in the JWT token, and then data from the req.user is used.
For example: I have an endpoint to create accounts, I need to enter the following columns in the database: ["id", "name", "user_id"] and I expect to receive from my frontend a POST request containing only the name, the id will be created in the my usecase, but what about the user_id ? I don't want to have to receive this data in the body of the request, because it's an extra field to be configured in the frontend, and I already have the user ID in my authentication token, so, within the steps of my usecase, I want to have access to the req.user data.
Is your feature request related to a problem? Please describe.
Inside my usecase, I don't have access to the req.user data, I only have access to them inside the authorize function, and most apis that use express, make use of various data that comes from within the req.user, not just from req.body.
Describe the solution you'd like
The default controller receives the req from express, and passes the req.user to the usecase authorize function, so I can make the proper assertion on the user, the req.user comes from some express middleware that was configured by the developer.
However, many express APIs use other data from req.user, like an id for example, instead of receiving the user's id in the request, it is simply received in the JWT token, and then data from the req.user is used.
For example: I have an endpoint to create accounts, I need to enter the following columns in the database: ["id", "name", "user_id"] and I expect to receive from my frontend a POST request containing only the name, the id will be created in the my usecase, but what about the user_id ? I don't want to have to receive this data in the body of the request, because it's an extra field to be configured in the frontend, and I already have the user ID in my authentication token, so, within the steps of my usecase, I want to have access to the req.user data.
Additional context
Example of an api request that makes use of req.user
https://github.com/vitorgamer58/BarrigaRest/blob/master/src/routes/accounts.js#L18
The text was updated successfully, but these errors were encountered: