How to redirect blocked user to custom page?

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,

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.

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!

1 Like

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.

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:

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:

Hope this helps!