Handling failed authorization in Universal Login Page

Hi there.

I’m working with ASP .Net MVC project configured with Auth0 (through OICD).
On Auth0 side there are couple of rules and actions that check some user requirements. If those aren’t met, rules return error and actions deny access to api.
There is a wish from business to display custom message on Universal Login Page, similar to when user enters wrong email and there is this small popup ‘Wrong username or password’.
I’ve red that when an unexpected error occurs in the authentication process, OICD forwards it to the callback URL so the application can handle it.
Is there any possibility to catch and display those errors on Universal Login Page?

Hi @kacper.czerniak,

Yes, if your callback URL is valid, when an authorization error occurs, the Authorization Server returns the appropriate error and state parameters to your callback URL. In cases where your callback URL is invalid, your application will display the default Auth0 generic error page.

These are the options available in Auth0:

  1. Redirect users to a custom error page using either the dashboard or the Management API
  2. Configure Auth0 to render a custom error page on your behalf via the Management API

More information here: Customize Error Pages

Hope this helps!

2 Likes

@lily.wisecarver Thanks for reply!
I was thinking more of handling authorization error on default Auth0 generic error page when something within subsequent rule processing invalidates the user’s login flow.
The callback URL is valid, but what if I don’t want to handle this error on application side? Is this possible?

1 Like

Hi @kacper.czerniak ,

Thanks for the clarification. Any error related to authentication can be handled in Auth0 login screen. However, if you are throwing the error message from the rule, there is no mechanism to customize it in the Universal Login Page. You can look at the Auth0 Lock error customization options to understand the error options.

The UL page internally uses Lock. You can enable the customization in Lock using the Auth0 Dashboard.
Branding-> Universal Login → Login → Customize Login Page → {Default Templates to use Lock template}

Let me know if you have any questions.

2 Likes

Thanks for helping on this one Lily!

Unfortunately I wanted to display error message that I’m throwing from the rule or action. Those always set error to access_denied, so I thought there is possibility to catch that in the ULP and display error_description.
Thanks for the help though!

1 Like

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