I’ve got a single-page app where access tokens expire after 5 mins. I’m using
okta-auth-js (version 6.3.0) with the
autoRenew option and I’m listening for the
error events from the tokenManager - if there’s an error I sign the user out, and I just log the other events to the browser console for debugging (I’m using Firefox).
I left the app running overnight and I can see that the tokens were getting renewed every 4 1/2 mins as expected. But then around 00:15 the request to the
/token endpoint failed:
Firefox flags this as a CORS error, but the Mozilla docs say this:
The HTTP request which makes use of CORS failed because the HTTP connection failed at either the network or protocol level. The error is not directly related to CORS, but is a fundamental network error of some kind.
My Okta console shows no sign in its log of having received this last request (all the others are there) so I can only assume that there was a temporary network failure.
So my question is: how best to work around this situation? Can I get OktaAuth to retry after errors, or can I try renewing the token myself?