Question: Implementing a warning dialog before sign out redirect occurs


I’m using a typical PKCE hosted login setup based on the okta-react hosted login demo, initialized once at the top of the app with secure routes.

@okta/okta-auth-js”: “~5.10.1”,
@okta/okta-react”: “~6.4.1”

For the most part everything is working as as expected, but a few times a month users get redirected to the login page from their secure route, interrupting their work session. I implemented an error component expecting to log evidence of some session issue there but so far there are no exceptions, just intermittent redirects to the hosted login page, before their session was over.

I need to guarantee to my users that they can perform some actions before they are redirected, regardless of whether its standard session expiration or something gone wrong in the core library.

Without having yet examined the okta-react or okta-auth-js source, is there a documented, canonical way to add a redirect guard, or is the document location being manipulated somewhere directly so the behavior cannot be bocked by the API user ?