I have been working with user authentication in my application; access token life span is 30 minutes and refresh token life span is 7 days. The thing I would like to achieve: in case an access token expires after a user was already active on the website, it needs to auto-renew in the background without pointing it out to the user, so that he or she can continue seamless completion of his or her tasks.
How to track whether access token has expired and refresh it with refresh token where necessary? It’s Node.js backend and React.js frontend.
I want to update the token in the background without notifying the user or changing any page. All tasks should happen in the background. Also, if the user closes the page and later returns, the token should be refreshed when they arrive
Kuldeep Sonara is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.