# Amount of users Auto imported from Custom Database Connection

**URL:** <https://community.auth0.com/t/amount-of-users-auto-imported-from-custom-database-connection/134943>\
**Category:** Get Help\
**Tags:** custom-database-connections, connections\
**Created:** [May 24, 2024, 5:54pm UTC](https://community.auth0.com/t/amount-of-users-auto-imported-from-custom-database-connection/134943 "2024-05-24T17:54:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henrique.rotava.n](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/henrique.rotava.n/32/57412_2.png) [@henrique.rotava.n](https://community.auth0.com/u/henrique.rotava.n)\
**Post date:** [May 24, 2024, 5:54pm UTC](https://community.auth0.com/t/amount-of-users-auto-imported-from-custom-database-connection/134943/1 "2024-05-24T17:54:33Z")

</div>

We are migrating the users from a Firebase source, we set up a custom database connection, and some months later we enabled auto import, we have users who already logged in after the auto import was enabled and some that still do not have the password imported from Firebase. How can we know the amount of users that have already been fully migrated to Auth0?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 24, 2024, 8:50pm UTC](https://community.auth0.com/t/amount-of-users-auto-imported-from-custom-database-connection/134943/3 "2024-05-24T20:50:59Z")

</div>

Hi @henrique.rotava.n,

Welcome to the Auth0 Community!

You can find the users that have already been fully migrated to Auth0 by going to your [_Dashboard \> User Management \> Users_](https://manage.auth0.com/#/users) and searching by Connection.

On that page, you can pass in `identities.connection:"Your-Custom-Database-Connection-Name"` in the search field to filter for users in your custom database.

Alternatively, you can use the [User Import / Export Extension](https://auth0.com/docs/customize/extensions/user-import-export-extension) to export your users from your custom database connection.

This will provide you with a file of your exported users that you can download. Then, you can use this information to cross-check your Firebase source to verify which users have not yet migrated.

Let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![henrique.rotava.n](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/henrique.rotava.n/32/57412_2.png) [@henrique.rotava.n](https://community.auth0.com/u/henrique.rotava.n)\
**Post date:** [May 27, 2024, 1:51pm UTC](https://community.auth0.com/t/amount-of-users-auto-imported-from-custom-database-connection/134943/4 "2024-05-27T13:51:28Z")

</div>

Hi @rueben.tiow ,

The thing is that even if the user is already imported to my custom connection, the “Import Users to Auth0” could be off at the time, once I turn it on the password hash would be persisted to Auth0 accordingly to the following diagram:

Based on this flow [Import and Export Users](https://auth0.com/docs/manage-users/user-migration)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/7/1/719f6cf990346065c4b16a1f01159a9dc50af90a.png)

How do I know the password is also imported to Auth0 for those users?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 28, 2024, 10:43pm UTC](https://community.auth0.com/t/amount-of-users-auto-imported-from-custom-database-connection/134943/5 "2024-05-28T22:43:00Z")

</div>

Hi @henrique.rotava.n,

Thanks for your update.

> [@henrique.rotava.n](#):
>
> How do I know the password is also imported to Auth0 for those users?

You could add a flag to the user’s `user_metadata` to indicate that they have migrated in your Login database action script.

For example, here’s a sample script:

```auto
function login(email, password, callback) {
  const bcrypt = require('bcrypt');
  const MongoClient = require('mongodb@3.1.4').MongoClient;
  const client = new MongoClient('mongodb://user:pass@localhost');

  client.connect(function (err) {
    if (err) return callback(err);

    const db = client.db('db-name');
    const users = db.collection('users');

    users.findOne({ email: email }, function (err, user) {
      if (err || !user) {
        client.close();
        return callback(err || new WrongUsernameOrPasswordError(email));
      }

      bcrypt.compare(password, user.password, function (err, isValid) {
        client.close();

        if (err || !isValid) return callback(err || new WrongUsernameOrPasswordError(email));

        return callback(null, {
            user_id: user._id.toString(),
            nickname: user.nickname,
            email: user.email,
            user_metadata: { migrated: true }
          });
      });
    });
  });
}

```

This way, you can query for the list of users in your custom database connection and filter to find which users have the migrated flag. If the user logs in at least once since you turned on the “Import users to Auth0” feature, they will have the migrated flag. Users without the migrated flag will mean that they have not yet migrated their passwords.

(Reference: [Verify user migration is complete](https://auth0.com/docs/manage-users/user-migration/configure-automatic-migration-from-your-database#verify-user-migration-is-complete))

I hope that helps!

Thanks,  
Rueben

---

<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:** [June 11, 2024, 10:43pm UTC](https://community.auth0.com/t/amount-of-users-auto-imported-from-custom-database-connection/134943/6 "2024-06-11T22:43:16Z")

</div>

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