I have a frontend connected to a NestJs backend with JWT authentication implemented. Users can sign up and sign in. Now I am wondering how I can prevent refreshing the browser from requiring another log in.
I researched a bit and wanted to ask here to see if my thinking is correct. I am thinking to store the access token in the browser cookies. If a refresh happens, I will send a request with the cookie access token to a new route. Since I have AuthGaurds setup, if the request is successful I will return the userid from the access token and the user will not be logged out. Then I can use this userid and access token for further requests. (I use the userid to filter on the DB and hence need a way to get the userid when the user refreshes the screen)
Is this an appropriate method?