# Render a custom error page from Rule

**URL:** <https://community.auth0.com/t/render-a-custom-error-page-from-rule/61010>\
**Category:** Get Help\
**Tags:** error-page, rules, login\
**Created:** [April 13, 2021, 7:35am UTC](https://community.auth0.com/t/render-a-custom-error-page-from-rule/61010 "2021-04-13T07:35:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [April 13, 2021, 1:29pm UTC](https://community.auth0.com/t/render-a-custom-error-page-from-rule/61010/3 "2021-04-13T13:29:32Z")

</div>

Hi @narendravaghela,

Welcome to the Community!

Unfortunately, because of the way that the OpenID Connect prescribes the login flow, Auth0 redirects the user to the callback URL with the error so that the application can display the error to the user.

The answer in this topic provides more info on the reason behind this behavior:

> [@Handling authorization\_error with hosted pages](https://community.auth0.com/t/handling-authorization-error-with-hosted-pages/9931/11):
>
> Hi, The way OIDC works is by redirecting users to a page where they are authenticated, and in case there is an unexpected error in the authentication process, forward it to the callback URL so the application can handle it. In the Auth0 server, rules are run after the user is authenticated, so it’s not possible for us to display errors in the login dialog itself (e.g. you could enter username/password, get prompted MFA, and then get an error from a rule), so those errors are sent to the applic…

There are some examples of how to implement the error handling in the [quickstart apps](https://auth0.com/docs/quickstarts/). For example, the React quickstart handles the error using:

```auto
const App = () => {
  const { isLoading, error } = useAuth0();

  if (error) {
    return <div>Oops... {error.message}</div>; // <-- This is where you'd render the custom error component/page
  }

  if (isLoading) {
    return <Loading />;
  }

  return (
    <Router history={history}>
      <div id="app" className="d-flex flex-column h-100">
        <NavBar />
        <Container className="flex-grow-1 mt-5">
          <Switch>
            <Route path="/" exact component={Home} />
            <Route path="/profile" component={Profile} />
            <Route path="/external-api" component={ExternalApi} />
          </Switch>
        </Container>
        <Footer />
      </div>
    </Router>
  );
};

```

---

_[View the full topic](https://community.auth0.com/t/render-a-custom-error-page-from-rule/61010)._
