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

Did you find a way to do this?

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

use

$client = new Google_Client();
...
...
$client->setHostedDomain("domain.com");
1 Like

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

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