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?

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.

1 Like