Incorrect Okta Sign In Widget config causes infinite refresh

I’m using the Okta Sign In Widget in such a way that it exists on my SPA directly on the login page that the auth server uses as a login redirect page.

If my Sign In Widget is configured incorrectly, specifically if I set useClassicEngine to false when it should be true, the widget shows this:

It stays there for a few seconds then appears to recreate the widget and automatically try to connect again, fails again, refreshes again … and so on in a loop.

That automatic initial connection is under the hood of the widget, it seems, and I don’t get any failure or success from the widget. I just get this endless cycling.

I get a stack like this in the network tab:

And the message in the URL is: identity provider is not valid.

I understand what the configuration problem is and I can fix it, but I want the widget not to cycle endlessly like this. Is there a way to catch that initial error since it doesn’t come in through the error handler?

I create it like this:

const widget = new OktaSignIn(widgetConfig);

const { searchParams } = new URL(window.location.href);

widget.otp = searchParams.get(‘otp’);
widget.state = searchParams.get(‘state’);
widget
.showSignInToGetTokens({
el: widgetRef.current,
})
.then(onSuccess)
.catch(onError);

I added an afterRender as well as an afterError and it’s failing in the device-challenge-poll context (per the afterRender) but I never get afterError. It just goes to the successRedirect context next and tries again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.