Action for Pre User Registration

Hi @friedman.ido,

Welcome to the Auth0 Community!

This will require two Action scripts to implement since a Pre User Registration Action only affects users who register through a Database or Passwordless connection.

First, in a Pre-User Registration Action, you will want to block users from signing up with a username and password if they exist in a Social Connection by calling the Management API’s Search Users by email endpoint. If the user is found, deny them from signing up.

Next, you will also need to create a Post Login Action script to block users from logging in with a Social Connection (Google in this case) if they exist in a Username-Password database connection by calling the Management API’s Search Users by email endpoint.

Recall that we cannot use a Pre-User Registration Action with Social Connections, therefore, we recommend using a Post-Login Action to check if it’s the Social Connection user’s first time logging in. If so, we can conclude that they are signing up and proceed with our blocking logic. However, please note that this will still create a Social Connection user but prevent them from logging in.

I have shared some resources below that will help with the implementation:

Please let me know how this goes for you or if you need additional help with the implementation.

Thanks,
Rueben

1 Like