yakir
April 22, 2021, 8:00pm
1
Hi
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:
Question: Can I show errors raised in rules in the login page?
Sometimes you have a rule that denies authorization, like this:
function (user, context, callback) {
if (someCondition) {
return callback(new UnauthorizedError('You are now allowed.'));
}
return callback(null, user, context);
]
Can that error be displayed in the login window?
Answer: No (how’s that for a spoiler?)
At least at the time of writing this, by the time rules run the authentication step (which is the responsi…
1 Like
system
Closed
May 8, 2021, 11:57am
4
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.