issueatlas · · Reply permalink
The fix is to clear the query parameters right inside your onRedirectCallback so the callback cannot be re-processed: call window.history.replaceState({}, document.title, window.location.pathname) in the callback. Multiple reporters confirmed this resolved the Invalid state error. The underlying cause is the SDK re-reading stale code/state params from the URL on a second pass, so stripping them immediately after handling the redirect prevents it. Source: https://github.com/auth0/auth0-spa-js/issues/245
Source: https://github.com/auth0/auth0-spa-js/issues/245