Error with auth0 in React: Error Invalid state at e

m having a problem with auth0 on React.

I use auth0 hook

  const {isAuthenticated, isLoading, error } = useAuth0();

For a second, I have isLoading and isAuthenticated both in false (this is weird), and I have an error from auth0:

Everything was ok ( isLoading = true , isAuthenticated = false ) but for a second both became false and this error appears:

isAuthenticated: false
isLoading: false
error: Error: Invalid state at e.<anonymous> (http://localhost:3000/static/js/vendors~main.chunk.js:5919:155) at http://localhost:3000/static/js/vendors~main.chunk.js:2439:17 at Object.next (http://localhost:3000/static/js/vendors~main.chunk.js:2451:8) at http://localhost:3000/static/js/vendors~main.chunk.js:2360:33 at new Promise (<anonymous>) at r (http://localhost:3000/static/js/vendors~main.chunk.js:2337:10) at e.handleRedirectCallback (http://localhost:3000/static/js/vendors~main.chunk.js:5901:56) at http://localhost:3000/static/js/vendors~main.chunk.js:6495:24 at step (http://localhost:3000/static/js/vendors~main.chunk.js:2265:17) at Object.next (http://localhost:3000/static/js/vendors~main.chunk.js:2196:14) at http://localhost:3000/static/js/vendors~main.chunk.js:2168:67 at new Promise (<anonymous>) at __awaiter (http://localhost:3000/static/js/vendors~main.chunk.js:2147:10) at http://localhost:3000/static/js/vendors~main.chunk.js:6483:14 at http://localhost:3000/static/js/vendors~main.chunk.js:6546:7 at invokePassiveEffectCreate (http://localhost:3000/static/js/vendors~main.chunk.js:96244:24) at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/vendors~main.chunk.js:76860:18) at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/vendors~main.chunk.js:76909:20) at invokeGuardedCallback (http://localhost:3000/static/js/vendors~main.chunk.js:76969:35) at flushPassiveEffectsImpl (http://localhost:3000/static/js/vendors~main.chunk.js:96326:13) at unstable_runWithPriority (http://localhost:3000/static/js/vendors~main.chunk.js:116214:16) at runWithPriority$1 (http://localhost:3000/static/js/vendors~main.chunk.js:84266:14) at flushPassiveEffects (http://localhost:3000/static/js/vendors~main.chunk.js:96203:18) at http://localhost:3000/static/js/vendors~main.chunk.js:96084:15 at workLoop (http://localhost:3000/static/js/vendors~main.chunk.js:116164:38) at flushWork (http://localhost:3000/static/js/vendors~main.chunk.js:116138:18) at MessagePort.performWorkUntilDeadline (http://localhost:3000/static/js/vendors~main.chunk.js:115904:31)
    message: "Invalid state"
    stack: "Error: Invalid state\n    at e.<anonymous> (http://localhost:3000/static/js/vendors~main.chunk.js:5919:155)\n    at http://localhost:3000/static/js/vendors~main.chunk.js:2439:17\n    at Object.next (http://localhost:3000/static/js/vendors~main.chunk.js:2451:8)\n    at http://localhost:3000/static/js/vendors~main.chunk.js:2360:33\n    at new Promise (<anonymous>)\n    at r (http://localhost:3000/static/js/vendors~main.chunk.js:2337:10)\n    at e.handleRedirectCallback (http://localhost:3000/static/js/vendors~main.chunk.js:5901:56)\n    at http://localhost:3000/static/js/vendors~main.chunk.js:6495:24\n    at step (http://localhost:3000/static/js/vendors~main.chunk.js:2265:17)\n    at Object.next (http://localhost:3000/static/js/vendors~main.chunk.js:2196:14)\n    at http://localhost:3000/static/js/vendors~main.chunk.js:2168:67\n    at new Promise (<anonymous>)\n    at __awaiter (http://localhost:3000/static/js/vendors~main.chunk.js:2147:10)\n    at http://localhost:3000/static/js/vendors~main.chunk.js:6483:14\n    at http://localhost:3000/static/js/vendors~main.chunk.js:6546:7\n    at invokePassiveEffectCreate (http://localhost:3000/static/js/vendors~main.chunk.js:96244:24)\n    at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/vendors~main.chunk.js:76860:18)\n    at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/vendors~main.chunk.js:76909:20)\n    at invokeGuardedCallback (http://localhost:3000/static/js/vendors~main.chunk.js:76969:35)\n    at flushPassiveEffectsImpl (http://localhost:3000/static/js/vendors~main.chunk.js:96326:13)\n    at unstable_runWithPriority (http://localhost:3000/static/js/vendors~main.chunk.js:116214:16)\n    at runWithPriority$1 (http://localhost:3000/static/js/vendors~main.chunk.js:84266:14)\n    at flushPassiveEffects (http://localhost:3000/static/js/vendors~main.chunk.js:96203:18)\n    at http://localhost:3000/static/js/vendors~main.chunk.js:96084:15\n    at workLoop (http://localhost:3000/static/js/vendors~main.chunk.js:116164:38)\n    at flushWork (http://localhost:3000/static/js/vendors~main.chunk.js:116138:18)\n    at MessagePort.performWorkUntilDeadline (http://localhost:3000/static/js/vendors~main.chunk.js:115904:31)"
    __proto__: Object

Then, again isAuthenticated takes their real value and the error dissapear. I don’t know why is happening.