Hello,
You can use the Management API within Auth0 Pre-Registration Action to check if the user with the same email already exists in another connection:
Here’s the sample Pre-registration Action you can create:
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 to debug Auth0 Extensibility such as Actions, Hooks and Rules.
I hope this helps!