# Auth0 Account Migration Using "abbaspour/auth0-account-migration"

**URL:** <https://community.auth0.com/t/auth0-account-migration-using-abbaspour-auth0-account-migration/203441>\
**Category:** Get Help\
**Tags:** user-management, management-api, auth0\
**Created:** [September 17, 2026, 5:24pm UTC](https://community.auth0.com/t/auth0-account-migration-using-abbaspour-auth0-account-migration/203441 "2026-09-17T17:24:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abuscaglio](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/abuscaglio/32/80844_2.png) [@abuscaglio](https://community.auth0.com/u/abuscaglio)\
**Post date:** [September 17, 2026, 5:24pm UTC](https://community.auth0.com/t/auth0-account-migration-using-abbaspour-auth0-account-migration/203441/1 "2026-09-17T17:24:40Z")

</div>

Good Morning!

I am attempting to implement lazy migration for Auth0 tenants using the following github code:

> **[GitHub - abbaspour/auth0-account-migration: Lazy Migration for Auth0 Tenants](https://github.com/abbaspour/auth0-account-migration)**
>
> Lazy Migration for Auth0 Tenants

The issue I am running into, is that this code was last updated 9 years ago and the readme instructions for configuration within the Auth0 Management Dashboard for the new and old accounts no longer apply. Is there any advice you can give me on how to configure my accounts for use with this code?

Thanks  
T

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [September 18, 2026, 6:09pm UTC](https://community.auth0.com/t/auth0-account-migration-using-abbaspour-auth0-account-migration/203441/3 "2026-09-18T18:09:43Z")

</div>

You are attempting to implement lazy migration for Auth0 tenants using a 9-year-old GitHub repository (auth0-account-migration), but the configuration instructions in the README no longer match the current Auth0 Management Dashboard interface. You want to know how to configure your old and new Auth0 tenants to work with this code.

**Lazy migration is still a fully supported Auth0 feature, but the Dashboard interface has changed significantly since that code was written. You will need to update the configuration steps to match the current Dashboard UI. The core mechanism — custom database connections with login scripts — remains the same, but the specific steps and settings locations have changed.**

**[Root Cause]**

The GitHub repository was last updated 9 years ago, and Auth0's Management Dashboard has undergone significant UI redesigns and feature updates since then. The configuration steps in the README reference Dashboard locations and settings that no longer exist or have been moved. Additionally, the Node.js runtime and Auth0 API versions may have changed, potentially requiring updates to the code itself.

**Current Lazy Migration Architecture (Still Supported):**

Auth0 lazy migration works by:

1. **Creating a custom database connection** in your old Auth0 tenant that connects to your legacy user database
2. **Writing login and getUser scripts** that query your legacy database and validate credentials
3. **Enabling "Import users to Auth0"** so that when users log in, they are automatically migrated to the new Auth0 tenant
4. **Configuring your application** to use the custom database connection during the migration period
5. **Gradually migrating users** as they log in (lazy migration) or bulk importing remaining users

**Current Configuration Steps:**

**For the Old Tenant (Source of Users):**

**Step 1: Create a custom database connection**

**Navigate to** Auth0 Dashboard → Connections → Database.

**Click**"Create DB Connection" or select an existing custom database.

**Name it** something like "Legacy-Database" or "Migration-Source".

**Step 2: Configure the connection to your legacy database**

**In the connection settings, enable:**

- **"Import users to Auth0"** — This is the critical setting that enables lazy migration
- **"Disable Sign Ups"** (optional) — Prevents new users from being created in the legacy database

**Step 3: Write the login script**

**Click the**"Custom Database" tab → "Login" script.

**Replace the template with a script that:**

- Connects to your legacy database
- Queries for the user by email or username
- Validates the password against the legacy password hash
- Returns the user profile in the callback

**Example structure (update with your database details):**

```
function login(email, password, callback) {
  // Connect to your legacy database
  // Query for user by email
  // Validate password
  // Return user profile: { user_id, email, ... }
  // On error: callback(new WrongUsernameOrPasswordError(email))
}
```

**Step 4: Write the getUser script (optional but recommended)**

**Click the**"Custom Database" tab → "Get User" script.

**This script is called when Auth0 needs to fetch user information without a password. It should:**

- Connect to your legacy database
- Query for the user by email
- Return the user profile

**Step 5: Test the scripts**

**Click the**"Try Connection" button.

**Enter test credentials** from your legacy database.

**Verify that:**

- The script successfully connects to your legacy database
- The user is returned correctly
- The user is created in Auth0 (check Users section)

**Step 6: Enable the connection for your application**

**Navigate to** Applications → Your Application → Connections.

**Enable the custom database connection** you just created.

**Disable or deprioritize** the default "Username-Password-Authentication" connection (optional, depending on your migration strategy).

**For the New Tenant (Destination of Users):**

**Step 1: Verify the default database connection**

**Navigate to** Connections → Database.

**Ensure**"Username-Password-Authentication" exists and is enabled.

**Step 2: Enable the connection for your application**

**Navigate to** Applications → Your Application → Connections.

**Enable**"Username-Password-Authentication".

**This is where migrated users will be stored.**

**Step 3: Configure post-migration (optional)**

**Once users are migrated, you can:**

- Disable the custom database connection
- Keep only "Username-Password-Authentication" enabled
- Users will now log in directly to the new tenant

**Important Configuration Notes:**

**1. Connection must be enabled for the application**

**Common issue:** Users get "connection is not enabled" error.

**Solution:** Ensure the custom database connection is explicitly enabled for your application in Applications → Your Application → Connections.

**2. Script return values must be correct**

**The login script must return:**

```
callback(null, {
  user_id: "string", // Must be a string, not an integer
  email: "user@example.com",
  // ... other profile fields
});
```

**3. "Import users to Auth0" must be enabled**

**Without this setting, users are not migrated** — they are only authenticated against the legacy database.

**4. Username vs. email**

**If your legacy database uses usernames instead of emails:**

- Enable "Requires username" in the connection settings
- Update your scripts to return a `username` field in the profile
- Users will still need a unique email address

**Regarding the 9-Year-Old GitHub Code:**

**The code may need updates for:**

1. **Node.js runtime** — The code may use deprecated Node.js APIs or outdated libraries (e.g., `tedious@1.11.0` for SQL Server)
2. **Auth0 API versions** — If the code makes calls to Auth0 APIs, it may need to use current API versions
3. **Database libraries** — The database connection libraries may have newer versions with breaking changes
4. **Error handling** — Auth0 may have changed how errors are handled in custom scripts

**Recommended Approach:**

**Option 1: Use the GitHub code as a reference, not a template**

- Use the GitHub code to understand the lazy migration pattern
- Write your own login and getUser scripts tailored to your specific legacy database
- Follow the current Auth0 documentation for custom database connections

**Option 2: Update the GitHub code for current environments**

- Review the code for deprecated Node.js APIs
- Update database connection libraries to current versions
- Test thoroughly in a development tenant before using in production

**Option 3: Use Auth0's official migration tools**

**If lazy migration is not critical, consider:**

- **Bulk User Import** — Import all users at once using the Management API or Import/Export extension
- **Auth0 Deploy CLI** — Migrate tenant configurations between tenants
- **Management API** — Programmatically create users in the new tenant

**Next Steps:**

**1. Review the current Auth0 documentation**

**Read:** [Configure Automatic Migration from Your Database](https://auth0.com/docs/users/migrations/automatic)

**This is the official, current guide for lazy migration.**

**2. Identify your legacy database type**

**Determine whether you're migrating from:**

- SQL Server
- MySQL
- PostgreSQL
- MongoDB
- Custom REST API
- Other

**3. Write or update the login script**

**Use the GitHub code as a reference, but write a script specific to your database.**

**4. Test in a development tenant**

**Before using in production, test the entire flow:**

- Create test users in your legacy database
- Test the login script with "Try Connection"
- Verify users are created in Auth0
- Test login through your application

**5. Contact Auth0 Support if needed**

**If you encounter issues with:**

- Custom script syntax or Auth0 API changes
- Database connectivity
- User migration not working as expected

**Create a support ticket with:**

- Your legacy database type
- Your login script (with sensitive details redacted)
- Error messages from Auth0 logs
- Screenshots of your connection configuration

**Bottom line:** Lazy migration is still fully supported by Auth0. The 9-year-old GitHub code provides a valid pattern, but you will need to update the configuration steps to match the current Dashboard UI and potentially update the code itself for current Node.js and database library versions. Start with the official Auth0 documentation linked above, use the GitHub code as a reference for the script logic, and test thoroughly in a development environment before deploying to production.

Kind Regards,  
Nik

---

<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:** [September 28, 2026, 6:10pm UTC](https://community.auth0.com/t/auth0-account-migration-using-abbaspour-auth0-account-migration/203441/4 "2026-09-28T18:10:19Z")

</div>

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