Auth0 Pre-User Registration hook shows different message on universal signup page

I get the message “WE’RE SORRY, SOMETHING WENT WRONG WHEN ATTEMPTING TO SIGN UP.” even after setting up the message correctly in my hook. Below is what i am returning from one of my conditions.

return cb(new PreUserRegistrationError(‘Denied user registration in Pre User Registration Hook’, ‘Email is not allowed’));

I expect the message ‘Email is not allowed to show on the signup page’. However the logs show that everything is working.

2 Likes

I’m also facing this same issue.

I have been waiting for this feature since long. I got excited to see the documentation available for this some days back. I tried it by returning the PreUserRegistrationError error in the callback as shown in auth0-docs. So when I logged the error, it shows it in the logs. Sadly it’s still not showing on the UI.

I am already using the “Universal Login - New Experience” which is a prerequisite for this to work.

Please suggest if anything else I can try to make it work.

2 Likes

Has anyone got this to work?

@ojaynico What’s the structure of your PreUserRegistrationError object class? I wonder if it’s because Auth0 is looking for a particular property on the error instance and isn’t finding it.

I failed to get the error message to show correctly and decided not to use the hook. Hope someone gets a solution to this because it seems to be a problem for many developers.

Actually PreUserRegistrationError looks like a class to me since it is instantiated using the new keyword. And this class takes in two parameters which are both strings, the first parameter is the error shown in the logs (which worked for me as expected) and the second parameter is the error displayed to the user (which did not work as expected and returned above message i posted).
I hope auth0 checks what could be wrong with their hooks. Otherwise i moved on from this and decided not to use the hooks.

Hey there Folks!

Let me discuss that with our Extensibility team that is responsible for the Hooks.

1 Like

@ojaynico Sorry, I meant “object” in the OO sense, not the JS sense. My mistake. I’ve updated my comment.

Firstly, the PreUserRegistrationError class is a predefined type in the hook execution environment. I tried creating one and got a “redeclaration error” from the JS runtime. It would be great if the docs could be updated to indicate what global types or objects are available for scripts.

However the following is working for me

cb(new PreUserRegistrationError('Denied user registration in Pre User Registration Hook', "Whoop, whoop, whoop")); (you have to read that like Dr Zoidberg)

image

It does says in the Pre-User Registration docs that for the friendly message to appear “your tenant must be configured to use the Universal Login - New Experience”. Which Universal Login variant are you using?

1 Like

We were not using the Universal Login - New Experience by the time i posted this and we have changed our mind not to switch to it. We have multiple applications using the same auth0 tenant and it was not possible for us to run the hook for only that application without affecting the rest.
Otherwise we shall wait for communication from @konrad.sopala and see if it will help @brijesh1 solve the issue.

I’ll let you know as soon as I get the update from our Extensibility team.

2 Likes

We are experiencing same issue. Any update on this @konrad.sopala?

1 Like

konrad.sopala Hello, i am still experiencing same issue.
Actually we we want to block some emails from registration. And we can handle it with Actions or Hooks, but no one allows me to show some more meaningful error.

Could someone help me to find answer for the next questions…

  • Any updates about this issue?
  • Maybe there are some other ways to restrict certain emails from sign up, with ability to customise error message?

Hey, there!
@konrad.sopala could you please provide any update in this?
I’m also experiencing the same issue.

Despite using PreUserRegistrationError the error I get on the client side is generic:
{"name":"InternalExtensibilityError","statusCode":400,"code":"extensibility_error","message":"Extensibility error","description":"Extensibility error","fromSandbox":true}

Right now there is no way to understand on the client side what exactly is going on and handle error appropriately.

Tenant is configured to use New Universal Login Experience.
We are also using custom login and sign up pages

@konrad.sopala I’m also very much in need of this! Not sure what the point of the custom errors are in the actions, if we can’t display them to the users?

telling our members nothing more than “WE’RE SORRY, SOMETHING WENT WRONG” is a real bummer!

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!