Auth0 Home Blog Docs

Universal Login (node-auth0 WebAuth): Where did allowedConnections go?


#1

I was using Lock before, now I don’t know how to limit the login options presented to users when using universal login. I didn’t find anything on google, so asking here.
Thanks!


#2

You can set the allowedConnections property in the universal login page template in the dashboard


#3

Thanks @luis.rudge.
How can you set that dynamically, i.e. at app run time?
I have a stripeConnect connection, which shouldn’t be presented at page login time, but later, when a logged in user wants to connect their stripe account.


#4

You can customize your Universal Login Page to have any behavior you want. By default, our template will match anything you send in the connection param and put it inside the allowedConnections option:

    var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
      configurationBaseUrl: 'https://cdn.auth0.com/',
      auth: {
        sso:true,
        redirectUrl: config.callbackURL,
        responseType: (config.internalOptions || {}).response_type ||
          config.callbackOnLocationHash ? 'token' : 'code',
        params: config.internalOptions
      },
      assetsUrl:  config.assetsUrl,
      allowedConnections: connection ? [connection] : null,
      rememberLastLogin: true,
      language: language,
      languageDictionary: languageDictionary,
      theme: {
        //logo:            'YOUR LOGO HERE',
        //primaryColor:    'green'
      },
      prefill: loginHint ? { email: loginHint, username: loginHint } : null,
      closable: false,
      // uncomment if you want small buttons for social providers
      // socialButtonStyle: 'small'
    });

#6

@luis.rudge Thanks!

Nice, I got the part of Auth0Lock being called internally and customizable via Universal Login dashboard.

Now, what doesn’t work is passing variables like ‘connection’ to it from WebAuth:

new auth0.WebAuth({
…
connection: ‘stripeConnect’
})

didn’t seem to do the trick to limit the login options to just stripeConnect.
I debugged the call to Auth0Lock but didn’t see any place where that connection param was passed to Auth0Lock.

If that worked, I assume for my other case of limiting to multiple connections, I can just tweak the Universal Login script to not turn connection into an array and pass:

connection: [‘google-oauth2’, ‘Username-Password-Authentication’]

#7
webauth.authorize({connection: 'stripeConnect'});