Auth0 Home Blog Docs

Show authorization error on universal login page after rule

Hi! I want to enforce email verification before signup. I have used a rule as suggested here.

However, it’s unclear how to tell the user in the Universal Login window that they need to verify their email before logging in. I also cannot get the Universal login to show a flash error if the user is not verified.

Here’s the code I added to the login customization script in my dashboard:

lock.on("authorization_error", function(error) {
              lock.show({
                loginAfterSignUp: false,
                flashMessage:{
                  type: 'error',
                  text: error.error_description
                }
              });
            })

This does not fire; it only redirects the user to the login screen again without an error. I want to keep the user in the UI window rather than redirecting to a page in my application. How can I accomplish this?

I ended up using the solution shown here: https://community.auth0.com/t/handling-authorization-error-with-hosted-pages/9931/13

Hi @wordnik,

Welcome to the Auth0 Community!

Glad you were able to figure out a solution so quickly. Let us know if you have any more questions.

Best,
Dan

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