Hi Auth0 team,
We have a task to block signups from a certain domain and auth0 clientID so that we can do some manual administration ourselves and invite these users after that’s done.
We achieved this with a Pre-Registration Action that blocks signup in this case.
If the conditions for block are met, we run this to return an error.
api.access.deny(`domain_blocked_except_from_api`, `Your domain required invitation so please wait while an admin invites you`);
I expected this error to be shown as-is in the universal login, but it’s not and instead a generic error is shown.
We’re sorry, something went wrong when attempting to sign up.
We expect this message to say the specific friendly_message we provided:
Your domain required invitation so please wait while an admin invites you
When I investigated our customised Universal Login html, I see that we’re registering for a custom language error message for user_exists
like this:
languageDictionary.error = {
signUp: {
user_exists: `The user already exists, please use another email or <a class="text-link" href="${goBackURL}">go back and sign in</a> instead.`
}
}
Do I have to somehow add our action error code to that same list to show a good message for this error?
Here is an example of a typical error from auth0 signup internal systems:
{
"name": "BadRequestError",
"code": "user_exists",
"description": "The user already exists.",
"statusCode": 400
}
And here is the error generated from an Action api.access.deny call:
{
"name": "InternalExtensibilityError",
"statusCode": 400,
"code": "extensibility_error",
"message": "domain_blocked_except_from_api",
"friendly_message": "Your domain required invitation so please wait while an admin invites you",
"description": "domain_blocked_except_from_api",
"fromSandbox": true
}
How can I turn an api.access.deny() from an Action into a readable error in the Universal Login?