Auth0 Home Blog Docs

In Auth0-SPA-JS, why does the Auth0Client object take a long time to initialize?

Question: In Auth0-SPA-JS, why does the Auth0Client object take a long time to initialize?

Answer:

Sometimes the createAuth0Client asynchronous method can take over 30 seconds to complete. createAuth0Client may also return undefined and produce an error when you try to access it.

This is usually down to a configuration problem between your application, and the Auth0 application you’re trying to log in with. Things to check:

  • Make sure that options passed to createAuth0Client include the correct client ID and domain values for the app you’re using
  • Ensure that the Allowed Callback URLs , Allowed Web Origins , and Allowed Logout URLs are correctly set up in your Auth0 app settings for your application

To verify that you’re hitting this problem, check the logs in your Auth0 dashboard for any failed login events, which may provide a clue as to the problem.

Supporting Documentation:

Documentation: https://auth0.github.io/auth0-spa-js/index.html
Blog post: https://auth0.com/blog/introducing-auth0-single-page-apps-spa-js-sdk/ (when and how to use the new SDK in your JS apps)
Repo: https://github.com/auth0/auth0-spa-js
Community Announcement: JS Solution to Support Authorization Code in SPAs [Product Roadmap: Launched]

1 Like