Is there an Auth0 way to prohibit users to signup and login with those domains?
Is the above mentioned list complete or does Auth0 blocks more domains?
exports.onExecutePostLogin = async (event, api) => {
const blacklist = ["domain1", "domain2"];
var userEmailDomain = event.user.email.split('@')[1].split('.')[0] // Get the user's email domain
if(blacklist.includes(userEmailDomain)){
api.access.deny('invalid_request', "Access from your domain is not allowed.");
}
};
And an example Pre-User Registration script:
exports.onExecutePreUserRegistration = async (event, api) => {
const blacklist = ["domain1", "domain2"];
var userEmailDomain = event.user.email.split('@')[1].split('.')[0] // Get the user's email domain
if(blacklist.includes(userEmailDomain)){
api.access.deny('invalid_request', "Access from your domain is not allowed.");
}
};