There is a “pre-user-registration” trigger and a “Domain Based Registration” action.
When I attempt to add additional domains (my domain list is quite long), I encounter the error “invalid InstalledIntegration.Configuration[0]: embedded message failed validation | caused by: invalid NameValue.Value: value length must be between 0 and 2048 runes, inclusive”.
It seems there may be limitations in place.
Is it possible to resolve this issue or find a workaround?
I’m also sharing a small code snippet that would allow you to register from a allowedDomain list,
exports.onExecutePreUserRegistration = async (event, api) => {
const allowedDomains = ['example.com',]; // Add your allow domains here
// Extract the domain from the user's email
const domain = event.user.email.split('@')[1].toLowerCase();
// Check if the domain is in the allow list
if (!allowedDomains.includes(domain)) {
api.access.deny(`domain_not_allowed`,`Registration from domain ${domain} is not allowed.`);
}
};