The simple tutorial: An error occurred when fetching client data for Lock

Hi there,
I am trying to follow the tutorial: Test SAML SSO with Auth0 as Service Provider and Identity Provider
step by step.
All goes fine.
Unfortunately, the last step, when I open the simple HTML app,
The login button could not work.

The HTML:

<HTML>
<BODY>
<p> Click on the button to log in </p>

<script src="https://cdn.auth0.com/js/lock/11.14/lock.min.js"></script>
<script type="text/javascript">
  var lock = new Auth0Lock('vgRH8Hb3bBt94320kT1WIe7TrqgINyk5', 'my_domain_here.us.auth0.com',{
        auth: {
          redirectUrl: 'http://jwt.io',
          audience: 'https://your-audience.com',
          responseType: 'token',
          params: {scope: 'openid'}
        }
    });

  function signin() {
    lock.show();
  }
</script>
<button onclick="signin()">Login</button>
</BODY>
</HTML>

The error caught by Chrome:
index.js:493 Uncaught Error: Error: An error occurred when fetching client data for Lock: https://cdn.us.auth0.com/client/vgRH8Hb3bBt94320kT1WIe7TrqgINyk5.js?t1663261365919 could not be loaded.
at index.js:493:7

I have read all the similar topics online. I have checked the client ID and domain are exactly the same. No extensions are used in the browser. Tried with Chrome, firefox and IE. ALL the same result.

I have followed every steps in the provided tutorial.
You see, it’s so simple steps in the tutorial so I can make sure I exactly follow every steps.

Can any one kindly give me some hint?
I appreciate any help!

Hi @rui.liu2

Welcome to the Auth0 Community.

The only way I can reproduce your issue is by inserting an incorrect client id. You said you have checked this and it is correct. Perhaps the audience is causing an issue? can you try using the management api for an audience and see if this works just for testing against a valid api https://YOUR-DOMAIN/api/v2/

Warm regards.

Hi SaqibHussain,

Thanks a lot for your kind reply.

Unfortunately it doesn’t work for me. I changed the audience in the html file, with replacing YOUR-DOMAIN with my real domain name.

  1. I am sure the client ID is the same:
    the ID shown in the error message:
    vgRH8Hb3bBt94320kT1WIe7TrqgINyk5.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
    index.js:493 Uncaught Error: Error: An error occurred when fetching client data for Lock: https://cdn.us.auth0.com/client/vgRH8Hb3bBt94320kT1WIe7TrqgINyk5.js?t1663812859123 could not be loaded.
  • at index.js:493:7*

and compare with: copy from the auth0 board: vgRH8Hb3bBt94320kT1WIe7TrqgINyk5

  1. I have also tried to put the html file in localhost, as another tutorial mentions that it should not be opened directly from my disk.

  2. I tired to only use auth0 as an IDP and use samltest tool as a server, it works.

Thanks again for your help.

Hi @rui.liu2

Please can you try to update Lock to the latest patch level:

<script src="https://cdn.auth0.com/js/lock/11.34.0/lock.min.js"></script>

https://github.com/auth0/lock

Warm regards.

2 Likes

Thanks very much!
This solves that error!

2 Likes

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