'How to disable/enable Sign Ups for a specific application with Auth0?

Is there a way to disable or enable sign ups for a specific application which is independent of the “Disable Sign Ups”-toggle in the dashboard for login with passwordless email (Authentication/Passwordless/Email)?



Solution 1:[1]

Only partly.

It's possible via Pre-User-Registration Hook and/or or Rule with some caveats.


Pre-User-Registration Hooks :

https://auth0.com/docs/customize/hooks/extensibility-points/pre-user-registration

Something like this:

module.exports = function (user, context, cb) {

    return cb(new PreUserRegistrationError('Denied user registration in Pre-User Registration Hook', 'You are not allowed to register.'));
  }
};

Here you can just fail the registration at all times. Problem with Hooks is that that the Pre-User-Registration Hook does not trigger for social connections / federation, only Database Connections and Passwordless.


Alternatively via Rule:

https://auth0.com/docs/customize/rules

This will always work, but the downside is that the user gets created in Auth0, they will just not be able to further proceed.

In the Rule you basically check the number of logins, if it's 0, you know that it's a new user, and block the login that follows right after user creation (signup) as well as any other time.

Example rule: https://auth0.com/rules/disable-social-signup

Related earlier answer of mine regarding this, in the Auth0 forum:

Solution 2:[2]

You could implement a custom Universal Login SPA for sign-up/in that only allows users to sign-in. Pre-registration hook to safeguard against people bypassing the UX.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Ryan.Bartsch