Auth0 multi-tenant architecture - Multiple Database connections

We currently use Auth0 for authentication and use the user.app_metadata object to store information about the tenant for each user. We also have a requirement to list users per tenant.

Sadly Auth0’s policy is that you cannot search app_metadata fields when querying users.

You can however filter users using the identity provider, so per tenant i’ve created a custom database connection.

The question is how can i log in user in using multiple customer database connections also using the hosted pages? If i provide an array of available connections using the options.allowedConnections object it just defaults to the first connection, meaning users that are not on that connection can’t login.

What am i doing wrong here?

 var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
  auth: {
    redirectUrl: config.callbackURL,
    responseType: (config.internalOptions || {}).response_type ||
      config.callbackOnLocationHash ? 'token' : 'code',
    params: config.internalOptions
  assetsUrl:  config.assetsUrl,
  allowedConnections: 'company-a', 'company-b', 'company-c], //this doesn't seem to work
  rememberLastLogin: !prompt,
  language: language,
  languageDictionary: languageDictionary,
  theme: {
    logo:            '',
    primaryColor:    'purple'
  prefill: loginHint ? { email: loginHint, username: loginHint } : null,
  closable: false,
  // uncomment if you want small buttons for social providers
  // socialButtonStyle: 'small'
1 Like

Any updates? I am also interested.

1 Like