I am using React with Django Rest Framework as backend with proper permissions. I am using token authentication and axios to make queries to the django api. Firstly, I can do a login with credentials in my React interface, and I store access token in the local storage. After about 5 minutes, if I make a new query I get an error from django telling me "access deny". I can catch that kind of error and send the user to the login page again. But here I have two questions: 1- What should I do to refresh access token whereas the user is working? I have refresh token but I do not know what to do. 2- If I get rid of the first problem. I want the application goes automatically to login page after 5 minutes without any user activity. I mean, I want to go to login page without the need of an explicit click on all the possible options. Some kind of background query to django to detect expiration, so that I can redirect to login page.
Thank you in advanced.