# Post Login Action : How to know if the user is blocked

**URL:** <https://community.auth0.com/t/post-login-action-how-to-know-if-the-user-is-blocked/128082>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [February 22, 2024, 4:23pm UTC](https://community.auth0.com/t/post-login-action-how-to-know-if-the-user-is-blocked/128082 "2024-02-22T16:23:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ywaka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ywaka/32/50292_2.png) [@ywaka](https://community.auth0.com/u/ywaka)\
**Post date:** [February 22, 2024, 4:23pm UTC](https://community.auth0.com/t/post-login-action-how-to-know-if-the-user-is-blocked/128082/1 "2024-02-22T16:23:38Z")

</div>

Hi!  
I would like to know how to determine if the user is blocked on the post login action.  
I want to implement the app that directs users to specific pages and displays an error message if they’re blocked.  
Is there any event value maybe something like `event.user.blocked`?  
If not, is there any other solution?  
Thank you in advance!

```auto
exports.onExecutePostLogin = async (event, api) => {
        if (event.user.blocked) {. // I would like to do something like this
            api.redirect.sendUserTo("http://localhost:4300/home/?error=user_blocked");
        }
};

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [February 23, 2024, 3:12am UTC](https://community.auth0.com/t/post-login-action-how-to-know-if-the-user-is-blocked/128082/3 "2024-02-23T03:12:53Z")

</div>

Hey there @ywaka !

> [@ywaka](#):
>
> Is there any event value maybe something like `event.user.blocked`?  
> If not, is there any other solution?

There is not anything in particular related to a blocked user accessible in an Action - You could always add some sort of flag in [metadata](https://auth0.com/docs/manage-users/user-accounts/metadata) OR perhaps look into adding logic to catch the error in your application as described here:

> [@How to redirect blocked user to custom page?](https://community.auth0.com/t/how-to-redirect-blocked-user-to-custom-page/90301/8):
>
> 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!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 8, 2024, 3:13am UTC](https://community.auth0.com/t/post-login-action-how-to-know-if-the-user-is-blocked/128082/4 "2024-03-08T03:13:48Z")

</div>

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