Redirection on failed registration

Hi,

We use passwordless login with a custom Universal Login login page based on the Lock (Passwordless) template.
In the Pre User Registration flow we use a script that approves registration based if the email domain is on our allow-list, checked via an external API call.

Instead of just showing an error message to the denied users, we would like to redirect them to an external landing page. However, the api object of this flow does not have a redirect property: https://auth0.com/docs/customize/actions/flows-and-triggers/pre-user-registration-flow/api-object

How can I do this redirect at this step?

Hi @psandor,

Welcome to the Auth0 Community!

I understand you would like to redirect users who do not have a whitelisted domain.

In this scenario, I recommend using a Post-Login Action script to redirect your users if their email domain is not in the allow list. Note that the Post-Login Action script is the only flow that can redirect users in Actions. Please see the documentation below to learn more.

I hope this helps!

Please let me know if there is anything else I can do to help.

Thank you.

Hi Rueben,

Thank you for the quick response. Is the inability to redirect at Pre User Registration a technical limitation? Is there a way to add this option to the api object available at that stage?
There are multiple problems with redirecting after login. We need to allow the registration of users who are not on the allow-list, so our user database will be full of accounts that can’t log in. We send out a welcome message after registration, which again won’t make sense as they won’t be able to log in. In auth0, these users will be in a logged-in state (I assume) with who knows what side effects. Overall, I don’t think it’s practical to allow users not on the allow list to register, log in, and redirect only at the very end of the process.
Can the code in the Universal Login / Lock(Passwordless) template access the reason parameter I set in the api.access.deny(reason, userMessage) call in the pre-user-registration trigger? That way I could probably do the redirect, or at least show a link to the user on the login page.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Hi @psandor,

My apologies for the delayed response.

Yes, this is correct. The Pre-User Registration Action is limited with the API Object properties listed here.

Unfortunately, this is not possible. However, I would encourage you to submit a feedback request asking for the Pre-User Registration Action to allow redirection.

Unfortunately, this is also not possible.

My best recommendation for this scenario is to use api.access.deny(reason, userMessage) to display an error message to users that are not on the allow list. This way your Database will not be filled with users that are not allowed to log in.

Please reach out if there’s anything else I can do to help.

Thanks,
Rueben