I would like to implement user login using JWT, but there is some confusion.
First, when the user successfully logs in, the server issues an Access Token and a Refresh Token. Then, The server sends the user information (id, name, grade) in the Access Token.
At this time, the Refresh Token is stored in the database along with the userId and is not delivered to the client.
The Access Token has a period of 7 days, and if client return within 3 days, authenticate the user through the existing Access Token.
If access token has been more than 3 days, server uses the user_id to query the Refresh Token stored in the database. At this time, if the Refresh Token is valid, server will try to reissue the 7-day Access Token.
I want to manage users in this way, is this correct?
I think the server should not pass the Refresh Token to the client.
I've read the following, but I do not know how to do it properly. Thank you for your advice.