How To Set A Connection In Lock

Hello,

I’m trying to embed lock on an ASP.NET Web Forms page, and I’m trying to specify the connection that the users would log into from that page. Right now, Lock is defaulting to random connection which the user isn’t associated with.

Is there a way to specify the connection in Lock?

Here is my current code:

<script src="https://cdn.auth0.com/js/lock/10.14/lock.min.js"></script>
<script type="text/javascript">
    var lock = new Auth0Lock('@ConfigurationManager.AppSettings"auth0:ClientId"]', '@ConfigurationManager.AppSettings"auth0:Domain"]', {
        auth: {
            redirectUrl: 'http://localhost:4987/LoginCallback.ashx'
          , responseType: 'code'
          , params: {
              scope: 'openid profile',
              allowedConnections: 'CorrectConnection'],
          }
        },
        
    });


  function signin() {
      lock.show();
  }
</script>

Lock is defaulting to random connection

Can you clarify what you mean by this? What connection is it defaulting to? Your implementation looks correct for allowedConnections. Note the , in that line should be removed.

It turns out that because the client has more than 50 connections assigned to it, Lock is just picking one of the first 50 and my user is not in that first 50, so it’s not working.

Please see my response to your other question: http://community.auth0.com/answers/1073/view