-
Notifications
You must be signed in to change notification settings - Fork 695
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
Where is the user object coming from? #456
Comments
few.user is not what you want. It is an object which contains information that was encoded in JWT and got decided after successfull JWT validation. Client should send user information in req.body
|
@okonon Ok tnx man. So I have to first have a succesful login through JWT so I can update the user, is that it? Can I test this using Postman? |
First check if the route that your update function is tied to is protected with JWT. If yes then you will get req.user automatically if client (Postman) sends requests with valid Authorization token (you get this token from auth endpoint) Usually this req.user object is for checking JWT decoded info. I think you are confusing it with user records stored in the database. |
User routes are not protected. So I think you will not get req.user object at all. |
@okonon exactly, it is not protected. This is very confusing. How come no one noticed until now? Maybe we are missing something. This should be more clear in the documentation. |
see example pseudoscode below wrote it on my phone so I do not know if this actual code will work and I apologize for formatting
|
Hey guys, I'm currently studying nodejs, and this boilerplate is helping me a great deal. But I got stuck in one thing. See the code below to update an user
Is the client supposed to send the entire user in the request? If not, how is the user embedded in the request?
The text was updated successfully, but these errors were encountered: