# Auth0 multi-tenant architecture - Multiple Database connections

**URL:** <https://community.auth0.com/t/auth0-multi-tenant-architecture-multiple-database-connections/8809>\
**Category:** Get Help\
**Tags:** multi-tenant, database-connections, connections\
**Created:** [November 23, 2017, 12:37am UTC](https://community.auth0.com/t/auth0-multi-tenant-architecture-multiple-database-connections/8809 "2017-11-23T00:37:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liam](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@liam](https://community.auth0.com/u/liam)\
**Post date:** [November 23, 2017, 12:37am UTC](https://community.auth0.com/t/auth0-multi-tenant-architecture-multiple-database-connections/8809/1 "2017-11-23T00:37:02Z")

</div>

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: 'http://www.mydomain.co/img/logo.png',
    primaryColor: 'purple'
  },
  prefill: loginHint ? { email: loginHint, username: loginHint } : null,
  closable: false,
  // uncomment if you want small buttons for social providers
  // socialButtonStyle: 'small'
});

lock.show();

```

---

<div class="post-metadata">

**Author:** ![bcopeland](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bcopeland/32/7641_2.png) [@bcopeland](https://community.auth0.com/u/bcopeland)\
**Post date:** [February 2, 2018, 8:00am UTC](https://community.auth0.com/t/auth0-multi-tenant-architecture-multiple-database-connections/8809/2 "2018-02-02T08:00:38Z")

</div>

Any updates? I am also interested.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/auth0-multi-tenant-architecture-multiple-database-connections/8809/3 "2018-03-02T05:57:31Z")

</div>


