Delay after login redirect

I have integrated auth0 in my react app with the following tutorial Auth0 React SDK Quickstarts: Login

Locally in develop mode everything works fine. However when running the app with a production build I am expierencing a 6/7 second delay after the redirect from auth0 to my app.

Ive used the Chrome devtools JS profiler to debug this and got the following result:


The first 2 seconds it starts loading the page, after that it is idle for 5 seconds and then suddenly the app starts working.

This is the code that is called after the app starts working again:


It is all compiled js, so it is hard to say what it is doing but it looks like it is doing something with a storage event listener.

I would like to know where the delay comes from and if the time can be reduced.

Hey there!

Thanks for reporting that! Let me relay that info to our SDK team so they can look at that! Will get back to you soon!

After some debugging I came to the conclusion that the code await lock.acquireLock(GET_TOKEN_SILENTLY_LOCK_KEY, 5000); in Auth0Client.ts caused the delay because the lock is active. It looks like the release of that lock doesn’t get executed.

As a temporary workaround I added a window.localStorage.clear() before sending the client to the auth0 login form to make sure the lock isn’t active.

1 Like

Perfect glad you found a workaround! And thanks a lot for sharing! Would you mind creating an issue in the repo so that repo maintainers can potentially implement a fix for that?