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

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:
    sign up allowed admin user:
    sign up not allowed user:

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.


Did you find a way to do this?

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