Hi! Thanks so much for this, it's a great start. One question: what do you do in the authController?
Would it be possible to see the whole authentication process?
At the moment I have one middleware that reads the token with express-jwt and decodes the user to the context but I have no idea if that's the best way to do it.
In the auth controller I have the logic for authenticating, example validating credentials, if credentials match, return a token, get the auth user (decode jwt token) etc.
How I set the user context is as follows
Hi! Thanks so much for this, it's a great start. One question: what do you do in the authController?
Would it be possible to see the whole authentication process?
At the moment I have one middleware that reads the token with express-jwt and decodes the user to the context but I have no idea if that's the best way to do it.
A more extensive example would be great
In the auth controller I have the logic for authenticating, example validating credentials, if credentials match, return a token, get the auth user (decode jwt token) etc.
How I set the user context is as follows
and the getMe logic in auth controller is as following:
jwt.verify() returns the payload if the jwt token is valid and not expired.
Amazing, thanks so much for clarifying that