# How to allow user to sign up organization via google only if domain of email is equals to domain of organization?

**URL:** <https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355>\
**Category:** Get Help\
**Tags:** signup\
**Created:** [August 4, 2021, 7:28am UTC](https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355 "2021-08-04T07:28:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![json](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/json/32/26230_2.png) [@json](https://community.auth0.com/u/json)\
**Post date:** [August 4, 2021, 7:28am UTC](https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355/1 "2021-08-04T07:28:09Z")

</div>

I want to manage admin accounts with Auth0.  
To do that,

- Admin users can sign up with Auth0 via Google oauth
- Only users who have a Google account with the same domain as the admin organization can sign up.  
for example:  
organization domain: [example.com](http://example.com/)  
sign up allowed admin user: [json@example.com](mailto:json@example.com)  
sign up not allowed user: [json@gmail.com](mailto:json@gmail.com)

If there is organization in Event object of pre-user-registration action trigger, I can do that.

- Add domain metadata to the organization
- Deny if user have not the same domain as the organization

But I can’t do that because there is no organization in Event object of pre-user-registration.

---

<div class="post-metadata">

**Author:** ![jason.hill2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jason.hill2/32/33232_2.png) [@jason.hill2](https://community.auth0.com/u/jason.hill2)\
**Post date:** [September 13, 2022, 10:44pm UTC](https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355/2 "2022-09-13T22:44:26Z")

</div>

Did you find a way to do this?

---

<div class="post-metadata">

**Author:** ![jason.hill2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jason.hill2/32/33232_2.png) [@jason.hill2](https://community.auth0.com/u/jason.hill2)\
**Post date:** [September 13, 2022, 10:58pm UTC](https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355/3 "2022-09-13T22:58:53Z")

</div>

I figured out that you can use an email domain whitelist rule to achieve this:

> **[Auth0 IP Addresses for Allow Lists](https://auth0.com/docs/secure/security-guidance/data-security/allowlist)**
>
> Lists Auth0 IP addresses for use in allow lists for inbound traffic behind a firewall.

---

<div class="post-metadata">

**Author:** ![wezoalves](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wezoalves/32/46609_2.png) [@wezoalves](https://community.auth0.com/u/wezoalves)\
**Post date:** [April 22, 2023, 5:56pm UTC](https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355/4 "2023-04-22T17:56:34Z")

</div>

use

```auto
$client = new Google_Client();
...
...
$client->setHostedDomain("domain.com");

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 24, 2023, 6:33am UTC](https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355/5 "2023-04-24T06:33:16Z")

</div>

Thanks for sharing it with the rest of community @wezoalves !

---

<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:** [May 8, 2023, 6:33am UTC](https://community.auth0.com/t/how-to-allow-user-to-sign-up-organization-via-google-only-if-domain-of-email-is-equals-to-domain-of-organization/67355/6 "2023-05-08T06:33:59Z")

</div>

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