I have a blog application I am building. I used node.js, expressjs, mongodb and reactjs. This is how I implemented the jwt system in the app:
When a user logs-in, the user generates accessToken and a refresh_Token. The accessToken will expire in 15 minutes while the refresh_Token expires in 30 days. I also stored the refresh_Token in redis database.
I created a route for the refresh token so that the user can generate another accessToken without logging out. Now, at the point of regenerating a new accessToken via the refresh route, the user also generates a new refresh_Token. I read that I should do that. My question is this: what happens to the previous refresh_Tokens each time a new accessToken and refresh_Token are generated? Since the refresh_Token route is called every 15 minutes to generate new accessToken and refresh_Token before it expires in 30 days? Are they kept somehwere? Using the redis.set(), the previous refresh_Tokens are always replaced with the new ones. So, I can't see the previous token in the redis database. Where are they kept for the 30 days before they expire and becomes invalid?