Auth0-spa-js - failed call to createAuth0Client takes a minute to return

Hello,

I am using auth0-spa-js with React. I have created an Auth0Provider as per the documentation, and when I have an internet connection everything works fine.

However I have noticed that if I don’t have an internet connection, the call to await createAuth0Client(…) takes about a minute to return, even though the network call fails immediately.

For example the network call to https://[my-custom-auth-domain]/authorize?.. fails immediately with ERR_NAME_NOT_RESOLVED. I would expect in this case for the call to return immediately so my IsLoading state can be set to false and I can show an appropriate screen on my app. But because of this delay, on startup my app stays on the loading screen for a minute which is not acceptable.

I am passing the below configuration to createAuth0Client:

{
audience: ‘[my audience value]’,
client_id: ‘[my client id]’,
domain: ‘[my custom auth domain]’,
redirect_uri: window.location.origin,
}

Is there as way I can resolve this by perhaps passing a timeout value, or does this require a change in the library? Thanks.

Hi @jonathan.dudley

This issue sounds similar to the one listed below. Can you confirm the solution they suggested is not applicable? If you do feel like this issue is related to the library, raising the issue directly in the GitHub repo would be the most effective way to communicate your need.

https://github.com/auth0/auth0-spa-js/issues/37

Let me know.

Thanks,
Dan

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