In a web app, I'm using WorkOS for authentication (with Convex), and I use a refresh page to refresh the session token, inspired by the Nordbase template. I was wondering if it would be a good option to replace or complement the refresh page with a modal that has the same functionality — refreshing the token — with the goal of improving UX by not losing what the user was working on, and also being faster since we don't have to load an entire new page and then return to the original one.
The specific use case is when the user navigates to an external page and comes back after a while to the app with an expired session. Instead of redirecting to the refresh page, a modal would load inline within the current protected-page-wrapper component, preserving the user's state, refresh the token and then show = false.
Is anything in particular that should I worry about this approach? I am only asking because it is a security sensitive flow, so I want to be sure that it is secure approach.