onRedirectCallback takes me back to my redirectURI for a split second before redirecting

Hi Guys,

I’m using the React SDK (in a next.js project) and struggling with this little issue that I can’t figure out the solution to!

So in my top-level app component, I have my Auth provider configured like so

const onRedirectCallback = (appState: AppState) => {
   Router.replace(appState?.returnTo || '/');

    <Component {...pageProps} />

I’m using withAuthenticationRequired to lock down a protected page. So when I visit this page, it correctly re-directs me to log in. Once I’ve logged in, it takes me back to the homepage of my app, briefly flashes the content for a split second before taking me back to the call back URL.

Any ideas of what could be causing this issue?