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: GitHub - auth0/auth0-spa-js: Auth0 authentication for Single Page Applications (SPA) with PKCE
Community Announcement: http://community.auth0.com/t/js-solution-to-support-authorization-code-in-spas-product-roadmap-launched/23178