React useAuth undefined when logging in and then going to different page/url

Hi,

So I have a login button on my landing page (www.example.com) and it redirects to my single page app/dashboard (www.example.com/home) after login. However, if I go back to the landing page my useAuth function is undefined for ~30 seconds.

Why is that and how can I fix it? Thanks!!

Hi @mgava,

Welcome to the Auth0 Community Forum!

Are you using spa.js? If so, it sounds like this FAQ may address your issue.

http://community.auth0.com/t/in-auth0-spa-js-why-does-the-auth0client-object-take-a-long-time-to-initialize/27878

Let me know if that does it.

Warm Regards,
Dan

1 Like

Hi Dan,

Thanks for your reply! Yes that was the problem. Specifically, this post also helped me once I looked at my logs: Failed Silent Auth problem, for anyone running into this problem too. Thanks again for your help.

Best,

Matthieu

Glad you were able to figure it out!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.