# User Already Exists Error When Creating Same Username in Different Database Connections

**URL:** <https://community.auth0.com/t/user-already-exists-error-when-creating-same-username-in-different-database-connections/187341>\
**Category:** Get Help\
**Tags:** custom-database-connections, connections\
**Created:** [May 29, 2025, 10:41am UTC](https://community.auth0.com/t/user-already-exists-error-when-creating-same-username-in-different-database-connections/187341 "2025-05-29T10:41:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![challa\_reddy](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/challa_reddy/32/70985_2.png) [@challa\_reddy](https://community.auth0.com/u/challa_reddy)\
**Post date:** [May 29, 2025, 10:41am UTC](https://community.auth0.com/t/user-already-exists-error-when-creating-same-username-in-different-database-connections/187341/1 "2025-05-29T10:41:23Z")

</div>

I’m using **username-based login** in my Auth0 setup. I have multiple **database connections** , each representing a different user group.

Here’s the issue:

- I have a user with the username `john_doe` in **Database A**.
- When I try to create a new user with the **same username** (`john_doe`) in **Database B** , I receive a **“user already exists”** error.

This is unexpected because I assumed usernames should be **unique per connection** , not globally across all database connections.

### **Expected Behavior:**

I should be able to create users with the same username in different database connections, as long as they are isolated.

### **Actual Behavior:**

Auth0 throws a `user already exists` error even though the user is being created in a different connection.

### **Steps to Reproduce:**

1. Create a user with username `john_doe` in Connection A.
2. Attempt to create another user with the same username in Connection B.
3. Observe the error.

### **Questions:**

- Is this expected behavior?
- Is there a workaround or configuration that allows username reuse across different database connections?

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [May 29, 2025, 10:58am UTC](https://community.auth0.com/t/user-already-exists-error-when-creating-same-username-in-different-database-connections/187341/2 "2025-05-29T10:58:19Z")

</div>

Hi @challa_reddy

Welcome to the Auth0 Community!

May I ask how you are creating users in the Auth0?

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [May 29, 2025, 11:28am UTC](https://community.auth0.com/t/user-already-exists-error-when-creating-same-username-in-different-database-connections/187341/3 "2025-05-29T11:28:26Z")

</div>

Hi @challa_reddy

I just tried, and I’ve been able to create a user in two separate databases with the same username. Can you verify if you are calling separate databases while creating a user?

Thanks  
Dawid

---

<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 12, 2025, 11:29am UTC](https://community.auth0.com/t/user-already-exists-error-when-creating-same-username-in-different-database-connections/187341/4 "2025-06-12T11:29:26Z")

</div>

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