Pre-registration hooks : send feedback to user

Hi,

I created a Pre-Registration hook.
I have a rule that refuse de user creation (duplicated user).
In case of error, I use the following code to reject the creation :
cb(users.length + ’ account(s) already exists ’ null, context);

But the user doesn’t receive any explaination about the failure :

How can I explain to the user why his account isn’t created ?

Regards,
Philippe

It’s not a new question, but I didn’t found any answer…
http://community.auth0.com/t/how-to-return-error-from-auth0-hooks/6327/14

The Hooks currently don’t allow to return a proper customized error message; when a Hook fails, it just returns a generic 500 http status with a generic error message (“An error occured”). Therefore, Hooks can’t currently be used properly for such kind of input validation.

But we are aware of the limitation and the product team is discussing this internally, so custom error messages will most likely be supported in the future at some point. But for now, it’s not possible.

The requirement is present on the forum for more than 2 years and are quite popular threads.
“At the Pre User Registration extensibility point, Hooks allow custom actions to be executed when a new user is created. For example, you may add custom app_metadata or user_metadata to the newly-created user, or even prevent the creation of the user in the database.”
It’s hard to understand that we can prevent a user request but not give him feedback…

Yes, I totally understand. However, there are many other feature requests in the product log, including those that don’t up in the community forum. The demand is definitely measured, but of course it’s not just based on community forum posts popularity, but also other factors. But I totally understand that it would be helpful to have this, and of course the sooner the better.

1 Like

Now that Hooks are about to leave beta @mathiasconradt, will this feature be part of the release?
I’m asking as it is also very important to us.

Update: customizing the hook error messages is now possible, see https://auth0.com/docs/hooks/extensibility-points/pre-user-registration#sample-script-customize-the-error-message-and-language-for-user-messages

Hi @mathiasconradt, we have followed the example given in the link above but we still see the generic message "WE’RE SORRY, SOMETHING WENT WRONG "