# Ngrok Custom Database connection via Login Action Script

**URL:** <https://community.auth0.com/t/ngrok-custom-database-connection-via-login-action-script/16317>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [October 4, 2018, 1:37pm UTC](https://community.auth0.com/t/ngrok-custom-database-connection-via-login-action-script/16317 "2018-10-04T13:37:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrBoutte](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@MrBoutte](https://community.auth0.com/u/MrBoutte)\
**Post date:** [October 4, 2018, 1:37pm UTC](https://community.auth0.com/t/ngrok-custom-database-connection-via-login-action-script/16317/1 "2018-10-04T13:37:35Z")

</div>

I’m trying to test my login action script for migrating users on a localDB via ngrok, but auth0 seems to be prepending port 3306 for me. Is there a way to stop this from automatically being prepended to my configuration.DB\_HOST? So when I test the connection via the “try” button, it trys to reach out to whatever I have stored in configuration.MYSQL\_HOST, which is my ngrok url pointing to my local tcp connection, and somehow the action script prepends the `3306`. So the end result of what it trys to connect to, looks something like `https://48e198bb.ngrok.io:3306` but `https://48e198bb.ngrok.io` is already pointing to that port on my computer, so auth0 reads it as :3306:3306

Here’s my login action script:

````function
  console.log("starting script");
  var connection = mysql({
    host: configuration.MYSQL_HOST,
    user: configuration.MYSQL_USER,
    password: configuration.MYSQL_PASSWORD,
    database: configuration.MYSQL_DB
  });

  connection.connect();

  var query = "SELECT id, email, password " +
    "FROM users WHERE email = ?";

  connection.query(query, [email], function (err, results) {
    if (err) return callback(err);
    if (results.length === 0) return callback(new WrongUsernameOrPasswordError(email));
    var user = results[0];

    bcrypt.compare(password, user.password, function (err, isValid) {
      if (err) {
        callback(err);
      } else if (!isValid) {
        callback(new WrongUsernameOrPasswordError(email));
      } else {
        callback(null, {
          id: user.id.toString(),
          email: user.email
        });
      }
    });

  });
}```
````

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [October 4, 2018, 6:44pm UTC](https://community.auth0.com/t/ngrok-custom-database-connection-via-login-action-script/16317/3 "2018-10-04T18:44:58Z")

</div>

Hey there @MrBoutte! I am currently looking into this with our support team but in the mean time will you DM me your tenant name when you get a chance? Thanks!

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [October 5, 2018, 2:03pm UTC](https://community.auth0.com/t/ngrok-custom-database-connection-via-login-action-script/16317/4 "2018-10-05T14:03:23Z")

</div>

After talking with our support team, they recommend trying setting the `port` value in mysql options to 80 or 443. Please let me know if you have any questions!

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [October 10, 2018, 1:38pm UTC](https://community.auth0.com/t/ngrok-custom-database-connection-via-login-action-script/16317/5 "2018-10-10T13:38:38Z")

</div>

I wanted to follow up with you this morning and see if you had any additional questions on this front @MrBoutte? Thanks!

---

<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:** [November 9, 2018, 1:38pm UTC](https://community.auth0.com/t/ngrok-custom-database-connection-via-login-action-script/16317/6 "2018-11-09T13:38:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
