# Auth0 Actions pre-user-registration (unique username)

**URL:** <https://community.auth0.com/t/auth0-actions-pre-user-registration-unique-username/69194>\
**Category:** Get Help\
**Tags:** actions\
**Created:** [September 7, 2021, 10:47am UTC](https://community.auth0.com/t/auth0-actions-pre-user-registration-unique-username/69194 "2021-09-07T10:47:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fernandohonig](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fernandohonig/32/31579_2.png) [@fernandohonig](https://community.auth0.com/u/fernandohonig)\
**Post date:** [September 7, 2021, 10:47am UTC](https://community.auth0.com/t/auth0-actions-pre-user-registration-unique-username/69194/1 "2021-09-07T10:47:10Z")

</div>

Hi,  
We are trying to avoid the “Account Linking” solution when a user registers with Social connection (Google/Microsoft) and then it also tries to sign-up with Username/Password by using a pre-user-registration action and provide with an error message to keep usernames unicity.

Do you have a sample code to use for this action?

Thanks in advance.

---

<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:** [September 17, 2021, 11:21pm UTC](https://community.auth0.com/t/auth0-actions-pre-user-registration-unique-username/69194/3 "2021-09-17T23:21:55Z")

</div>

Hi @fernandohonig,

Welcome to the Auth0 Community!

I understand that you are looking for a sample Action that prevents users from registering with a redundant username.

Unfortunately, there are no Action Templates available to accomplish this task. If you decide to implement the logic with an Action, you may find the [Event and API Objects](https://auth0.com/docs/actions/triggers/pre-user-registration/event-object) useful.

Next, I’d like to clarify that **Usernames** are unique and cannot be used more than once. Additionally, signing up with a Social Connection does not populate a Username property as seen with Database Connections.  
Because of this, you should not encounter any Username conflicts when your users sign up with a Database and Social Connection.

However, you may still want to consider linking the two accounts together to have a centralized user profile.

Doing so will allow you to manage your users more effectively.

Please let me know if you’ve any further questions. I’d be happy to clarify.

---

<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:** [October 2, 2021, 11:22pm UTC](https://community.auth0.com/t/auth0-actions-pre-user-registration-unique-username/69194/4 "2021-10-02T23:22:14Z")

</div>

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