It's very simple. Create a JavaScript timer or use a meta tag that has the same timeout plus a second as the authentication cookie expiration. When the timer runs out, refresh the page.
https://www.w3schools.com/tags/att_meta_http_equiv.asp
https://developer.mozilla.org/en-US/docs/Web/API/setTimeout