Saturday 17 November 2018

Storing user ID in a JSON web token's payload. Should the middleware function send it in req, or req.body?

I made a middleware function that validates a user's JWT. In the case that it's valid, it stores the user's ID in req and calls next() to handle the desired request.My question: Is it ok for the middleware function to store the ID in req.body, or should it only be in req?

Submitted November 17, 2018 at 09:55PM by v_95

No comments:

Post a Comment