# How to disallow a user to with a same email access another mode of authentication

**URL:** <https://community.auth0.com/t/how-to-disallow-a-user-to-with-a-same-email-access-another-mode-of-authentication/97030>\
**Category:** Get Help\
**Tags:** signup-prompt-new-experience, login-experience\
**Created:** [December 23, 2022, 4:05pm UTC](https://community.auth0.com/t/how-to-disallow-a-user-to-with-a-same-email-access-another-mode-of-authentication/97030 "2022-12-23T16:05:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devfrance00](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/devfrance00/32/34241_2.png) [@devfrance00](https://community.auth0.com/u/devfrance00)\
**Post date:** [December 23, 2022, 4:05pm UTC](https://community.auth0.com/t/how-to-disallow-a-user-to-with-a-same-email-access-another-mode-of-authentication/97030/1 "2022-12-23T16:05:54Z")

</div>

I have a application, in which a user can login with google and email password method.

But we have specific need that if a user is already signed up, say with google. then he won’t be allowed to create a account using email and password method. How I can do this?

---

<div class="post-metadata">

**Author:** ![art.stupels](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/art.stupels/32/30429_2.png) [@art.stupels](https://community.auth0.com/u/art.stupels)\
**Post date:** [December 23, 2022, 8:06pm UTC](https://community.auth0.com/t/how-to-disallow-a-user-to-with-a-same-email-access-another-mode-of-authentication/97030/2 "2022-12-23T20:06:44Z")

</div>

Hello,

You can use the [Management API within Auth0 Pre-Registration Action](https://community.auth0.com/t/how-can-i-use-the-management-api-in-actions/64947) to check if the user with the same email already exists in another connection:

Here’s the sample Pre-registration Action you can [create](https://auth0.com/docs/customize/actions/write-your-first-action):

```auto
exports.onExecutePreUserRegistration = async (event, api) => {
  const ManagementClient = require('auth0').ManagementClient;
  const management = new ManagementClient({
      domain: event.secrets.domain,
      clientId: event.secrets.clientId,
      clientSecret: event.secrets.clientSecret,
  });
  management.getUsers({q: `email:"${event.user.email}"` },function (err, users) {
    if (users.length >= 1) {
      api.access.deny("The user with this email already exists");
    }
  });
}

```

I recommend installing the [Real-Time Log Extension](https://auth0.com/docs/customize/extensions/real-time-webtask-logs) to debug Auth0 Extensibility such as Actions, Hooks and Rules.

I hope this helps!

---

<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:** [January 6, 2023, 8:06pm UTC](https://community.auth0.com/t/how-to-disallow-a-user-to-with-a-same-email-access-another-mode-of-authentication/97030/3 "2023-01-06T20:06:45Z")

</div>

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