# Is it possible to dynamically change allowedConnections depending on user input in Auth0Lock?

**URL:** <https://community.auth0.com/t/is-it-possible-to-dynamically-change-allowedconnections-depending-on-user-input-in-auth0lock/7784>\
**Category:** Get Help\
**Tags:** auth0-lock, config\
**Created:** [August 8, 2017, 10:39pm UTC](https://community.auth0.com/t/is-it-possible-to-dynamically-change-allowedconnections-depending-on-user-input-in-auth0lock/7784 "2017-08-08T22:39:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolemgrondin](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Nicolemgrondin](https://community.auth0.com/u/Nicolemgrondin)\
**Post date:** [August 8, 2017, 10:39pm UTC](https://community.auth0.com/t/is-it-possible-to-dynamically-change-allowedconnections-depending-on-user-input-in-auth0lock/7784/1 "2017-08-08T22:39:44Z")

</div>

Using the auth0Lock, is it possible to dynamically change the allowedConnections depending on user input? I’ve tried using lock.update on ‘signin submit’ but have yet to be successful. Is there something I’m overlooking?

```
lock.on('signin submit', ( ) => {
    lock.update((currentLock) => {
          if(currentLock.getIn('field', 'email', 'value']) === 'desired value') {
             return currentLock.updateIn( 'core', 'allowedConnections'], value => [alternativeDbConnection]);
          }
          return currentLock;
     }
})

```

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [August 9, 2017, 3:52pm UTC](https://community.auth0.com/t/is-it-possible-to-dynamically-change-allowedconnections-depending-on-user-input-in-auth0lock/7784/2 "2017-08-09T15:52:53Z")

</div>

Based on the information you provided, in particular, the field `alternativeDbConnection` I’m making a few assumptions:

- you have multiple database connections;
- you want to select the database connection to be used based on the provided username/email.

If my assumptions are correct then you should take a look at the `connectionResolver` [option](https://github.com/auth0/lock#other-options). Have in mind this is still a beta feature and is restricted to database connections.

---

<div class="post-metadata">

**Author:** ![Nicolemgrondin](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Nicolemgrondin](https://community.auth0.com/u/Nicolemgrondin)\
**Post date:** [August 9, 2017, 9:02pm UTC](https://community.auth0.com/t/is-it-possible-to-dynamically-change-allowedconnections-depending-on-user-input-in-auth0lock/7784/3 "2017-08-09T21:02:50Z")

</div>

Thanks! That’s exactly what I was looking for 🙂

---

<div class="post-metadata">

**Author:** ![Nicolemgrondin](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Nicolemgrondin](https://community.auth0.com/u/Nicolemgrondin)\
**Post date:** [August 9, 2017, 9:02pm UTC](https://community.auth0.com/t/is-it-possible-to-dynamically-change-allowedconnections-depending-on-user-input-in-auth0lock/7784/4 "2017-08-09T21:02:50Z")

</div>

Thanks! That’s exactly what I was looking for 🙂

---

<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:55am UTC](https://community.auth0.com/t/is-it-possible-to-dynamically-change-allowedconnections-depending-on-user-input-in-auth0lock/7784/5 "2018-03-02T05:55:49Z")

</div>


