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: example.com
    sign up allowed admin user: json@example.com
    sign up not allowed user: 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.

2 Likes