# Redirections or custom messages with links on the onExecutePreUserRegistration trigger

**URL:** <https://community.auth0.com/t/redirections-or-custom-messages-with-links-on-the-onexecutepreuserregistration-trigger/186390>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [May 6, 2025, 8:10pm UTC](https://community.auth0.com/t/redirections-or-custom-messages-with-links-on-the-onexecutepreuserregistration-trigger/186390 "2025-05-06T20:10:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![george.tsopouridis](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/george.tsopouridis/32/72254_2.png) [@george.tsopouridis](https://community.auth0.com/u/george.tsopouridis)\
**Post date:** [May 6, 2025, 8:10pm UTC](https://community.auth0.com/t/redirections-or-custom-messages-with-links-on-the-onexecutepreuserregistration-trigger/186390/1 "2025-05-06T20:10:36Z")

</div>

On this onExecutePreUserRegistration trigger, I am not allowing some domains to login and in this case I would like to redirect these users to a custom page or display an error message but with a clickable link instead of just using api.access.deny(‘notAllowedDomain’, userMessage)  
Is there any way to achieve something like this? Or can I at least return back to my client initiated the login with some error code (auth-spa loginWithRedirect)?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [May 6, 2025, 10:18pm UTC](https://community.auth0.com/t/redirections-or-custom-messages-with-links-on-the-onexecutepreuserregistration-trigger/186390/3 "2025-05-06T22:18:44Z")

</div>

Hi @george.tsopouridis

Welcome to the Auth0 Community!

As mentioned in [this](https://community.auth0.com/t/redirect-users-after-denying-registration/92198/3) community post, redirecting an user using the `PreUserRegistration` Trigger is not possible and only has the `api.access.deny(reason, message)` function available to deny access to the application.

Otherwise, [redirection](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/redirect-with-actions) is possible using a `PostLogin` Trigger in order to deny the user access to the application. The only issue would be, as in the mentioned community:

> Understandably, this will prevent user login and increment the number of users in your database, which may warrant some degree of grooming. However, this will not affect your MAU (Monthly Active Users) count since these users never successfully “logged in”.

Denying access using a `PostLogin` trigger would still create the user within Auth0, meaning that you would need to use the Management API to [delete the user](https://auth0.com/docs/api/management/v2/users/delete-users-by-id) if you do not wish them to exist within the connection used.

If you have any other questions, let me know!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 20, 2025, 10:19pm UTC](https://community.auth0.com/t/redirections-or-custom-messages-with-links-on-the-onexecutepreuserregistration-trigger/186390/4 "2025-05-20T22:19:03Z")

</div>

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