# Stop Gmail/Ms account with a certain domain from registering or logging in

**URL:** <https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [November 15, 2023, 10:00am UTC](https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930 "2023-11-15T10:00:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rezgui.aziz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rezgui.aziz/32/51642_2.png) [@rezgui.aziz](https://community.auth0.com/u/rezgui.aziz)\
**Post date:** [November 15, 2023, 10:00am UTC](https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930/1 "2023-11-15T10:00:28Z")

</div>

I want to allow only a handful of domains to be able to register and login with gmail or MS.  
I tried postLoginAction, it works but the user is still created in the users db in auth0 dashboard.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 17, 2023, 3:28pm UTC](https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930/3 "2023-11-17T15:28:35Z")

</div>

Hi @rezgui.aziz,

A post login action would be the correct way to limit theses social connections to specific domains.

The user is created in Auth0 and you could delete them using the [Auth0 Management API v2](https://auth0.com/docs/api/management/v2/users/delete-users-by-id).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![rezgui.aziz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rezgui.aziz/32/51642_2.png) [@rezgui.aziz](https://community.auth0.com/u/rezgui.aziz)\
**Post date:** [November 17, 2023, 4:27pm UTC](https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930/4 "2023-11-17T16:27:45Z")

</div>

Hey Dan, thanks for you answer, Can I integrate the Auth0 Management API v2 with actions, to have auto delete those accounts ? or do I have to do it manually?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 17, 2023, 4:28pm UTC](https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930/5 "2023-11-17T16:28:38Z")

</div>

Yes, you can use it directly in an Action.

[https://community.auth0.com/t/how-can-i-use-the-management-api-in-actions/64947](https://community.auth0.com/t/how-can-i-use-the-management-api-in-actions/64947)

---

<div class="post-metadata">

**Author:** ![rezgui.aziz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rezgui.aziz/32/51642_2.png) [@rezgui.aziz](https://community.auth0.com/u/rezgui.aziz)\
**Post date:** [November 17, 2023, 4:35pm UTC](https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930/6 "2023-11-17T16:35:09Z")

</div>

This is perfect, thanks a lot!

---

<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:** [December 1, 2023, 4:35pm UTC](https://community.auth0.com/t/stop-gmail-ms-account-with-a-certain-domain-from-registering-or-logging-in/120930/7 "2023-12-01T16:35:44Z")

</div>

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