# How to redirect blocked user to custom page?

**URL:** <https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301>\
**Category:** Get Help\
**Tags:** actions, rules\
**Created:** [September 8, 2022, 11:39pm UTC](https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301 "2022-09-08T23:39:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![greggs](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/greggs/32/33670_2.png) [@greggs](https://community.auth0.com/u/greggs)\
**Post date:** [September 8, 2022, 11:39pm UTC](https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301/1 "2022-09-08T23:39:28Z")

</div>

I would like to understand how to redirect a user that is blocked to a custom page on our website. That way we don’t see the error message. Can you provide guidance on how to accomplish this?

Would this be a job for a rule or an action?

- I’m using the standard login feature of Auth0. I’m not using social logins.
- I’m using NodeJS on the backend.
- I’m using the Auth0 managed login screen.

Instead of seeing the error below, I’d like to load a user friendly web page page to tell the user the account is blocked.

`BadRequestError: unauthorized (user is blocked)`

Thank you,

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [September 13, 2022, 7:28pm UTC](https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301/4 "2022-09-13T19:28:21Z")

</div>

Hi @greggs ,

I understand that you want to redirect blocked users to a custom page. Unfortunately, we don’t have an out-of-box feature to support redirecting blocked users to a custom page.

As an alternative, since your tenant has the New Universal Login set up, you can customize the text of the blocked user page. Ref: [Customize New Universal Login Text Prompts](https://auth0.com/docs/customize/universal-login-pages/customize-login-text-prompts).

If this is what you want to proceed with, could you send me a screenshot of the error page so I can check where is the below error located on the Login page?

`BadRequestError: unauthorized (user is blocked)`

Thanks!

---

<div class="post-metadata">

**Author:** ![greggs](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/greggs/32/33670_2.png) [@greggs](https://community.auth0.com/u/greggs)\
**Post date:** [September 13, 2022, 11:01pm UTC](https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301/6 "2022-09-13T23:01:41Z")

</div>

Hi Lihua.

Here’s what I see when I attempt to login as a blocked user. This is an example response from a NodeJS application that uses expressjs and express-openid-connect.

```auto
BadRequestError: unauthorized (user is blocked)
    at /Users/me/Development/client-app/node_modules/express-openid-connect/middleware/auth.js:121:19
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

```

Thank you for your assistance.

Sample screen shot:

 ![Example screen shot of error message](https://global.discourse-cdn.com/auth0/original/3X/0/e/0e023aa972c047453230b641cdb97c790abd9aa7.png)

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [September 14, 2022, 6:13am UTC](https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301/8 "2022-09-14T06:13:22Z")

</div>

Thank you for the updates. I see that the error is being returned to your applications callback endpoint.

So to configure a custom page to handle this error, in your application, you need to create a check at your POST /callback route that looks for an error being returned. Then you can handle the error by redirecting to a static error page.

I’m not an expert on Express. This may be a good place to start:

> **[Express error handling](https://expressjs.com/en/guide/error-handling.html)**

> **[Express error handling](https://expressjs.com/en/guide/error-handling.html#writing-error-handlers)**

Hope this helps!

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [February 2, 2023, 8:28pm UTC](https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301/9 "2023-02-02T20:28:07Z")

</div>


