Cancel login from within a rule


I’m using universal login.

I want within a rule to be able to make a decision that this user should not be logged in and fail his login.
But currently if I just do:

return callback(new UnauthorizedError(“Failed”));

It does redirect to my server at /complete/auth0/

But I want it to just fail and stay on the auth0 login page, same as if the user has inputted a wrong password.

P.S - This is done in social-login using google

Hi @yakir,

Unfortunately, rules run after authentication, and so redirecting back to the login page would go against the natural flow. When the UnauthorizedError is thrown in your rule, the user will be redirected to your app with the error message as a URL query string parameter.

Here is additional information from our FAQs:

1 Like

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