Auth0 Invalid State error occurs abruptly

Hi,

We are facing an intermittent issue of Invalid State, sometimes for certain users. This is sometimes hard to reproduce.

This is the app setup we are using auth0-react 1.5.0

I am seeing an intermittent issue of “Invalid-State” with my Next’s Static Apps which uses auth0-react-sdk.

This is my setup

const onRedirectCallback = appState => {
  console.log('OnRedirectCallback() => ', {appState})
  Router.replace(appState?.returnTo || `${window.location.origin}${TESTINDEX}`)
}

function MyApp({Component, pageProps}) {
  return (
    <Auth0Provider
      domain={process.env.NEXT_PUBLIC_AUTH0_DOMAIN}
      clientId={process.env.NEXT_PUBLIC_CLIENT_ID}
      audience={process.env.NEXT_PUBLIC_AUTH0_AUDIENCE}
      redirectUri={
        typeof window !== 'undefined' && `${window.location.origin}${TESTINDEX}`
      }
      onRedirectCallback={onRedirectCallback}
      useRefreshTokens
    >
      <Head>
        <meta name="viewport" content="width=device-width" />
        <meta charSet="utf-8" />
        <link rel="icon" type="image/png" href="/images/favicon.ico" />
      </Head>

      <Component {...pageProps} />
    </Auth0Provider>
  )
}

Please suggest what needs to be done to avoid this issue

I’ve been running into the same issue with the PHP SDK for over a year now. It’s very random, impossible to reproduce, but happens regularly (10ish times a day).

The logs on Auth0 show a successful login, but I’m getting a Core Exception: Invalid State within my application.

Can I ask you to raise it as a GitHub issue in our PHP-SDK repo so we can work on that directly with the repo maintainers?

Once you do that please share the link to it here with us so we can ping repo maintainers

Same issue still no fix to this.
My CC Pay

Hey there!

Have you by any chance had a moment to open a GitHub issue for that?