# Can I block user from log in all apps but one?

**URL:** <https://community.auth0.com/t/can-i-block-user-from-log-in-all-apps-but-one/83504>\
**Category:** Get Help\
**Tags:** api, users, access-token, management-api, login, auth0\
**Created:** [May 16, 2022, 2:39pm UTC](https://community.auth0.com/t/can-i-block-user-from-log-in-all-apps-but-one/83504 "2022-05-16T14:39:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlago](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dlago/32/37341_2.png) [@dlago](https://community.auth0.com/u/dlago)\
**Post date:** [May 16, 2022, 2:39pm UTC](https://community.auth0.com/t/can-i-block-user-from-log-in-all-apps-but-one/83504/1 "2022-05-16T14:39:53Z")

</div>

## Authorize users to some apps.

Hi !  
I´m trying to create users with restricted log in.  
I create 2 apps, like admin app and normal app.  
Admins can use both of them, but normal users just normal app.  
I want to create one user. The user can only have permissions to log in to admin app and not to the rest.  
How can I restrict the login to some users ?

---

<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:** [May 17, 2022, 12:05am UTC](https://community.auth0.com/t/can-i-block-user-from-log-in-all-apps-but-one/83504/3 "2022-05-17T00:05:45Z")

</div>

Hello and welcome the community @dlago!

> [@dlago](#):
>
> Admins can use both of them, but normal users just normal app.  
> I want to create one user. The user can only have permissions to log in to admin app and not to the rest.

I think I am understanding this correctly - If you want to deny access for a specific user, you might want to look into using using `api.access.deny(reason)` in a Post Login Action. Something like:

```auto
if ((event.client.name === "Application Name") && !userRoles.includes("admin"))
    api.access.deny(`Access to ${event.client.name} is not allowed.`);

```

This does assume you have roles assigned to users. You can access those in the Action with `event.authorization.roles`. For reference:

> **[Actions Triggers: post-login - Event Object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object)**
>
> Learn about the post-login Action trigger's event object, which provides contextual information about a single user logging in via Auth0.

> **[Actions Triggers: post-login - API Object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/api-object)**
>
> Learn about the post-login Action trigger's API object.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![dlago](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dlago/32/37341_2.png) [@dlago](https://community.auth0.com/u/dlago)\
**Post date:** [May 17, 2022, 7:19am UTC](https://community.auth0.com/t/can-i-block-user-from-log-in-all-apps-but-one/83504/4 "2022-05-17T07:19:16Z")

</div>

It is a way to do it, Thank you !

---

<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:** [June 1, 2022, 7:19am UTC](https://community.auth0.com/t/can-i-block-user-from-log-in-all-apps-but-one/83504/5 "2022-06-01T07:19:43Z")

</div>

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