# Block all users unless accepted

**URL:** <https://community.auth0.com/t/block-all-users-unless-accepted/106154>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [May 4, 2023, 11:19am UTC](https://community.auth0.com/t/block-all-users-unless-accepted/106154 "2023-05-04T11:19:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emy](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@emy](https://community.auth0.com/u/emy)\
**Post date:** [May 4, 2023, 11:19am UTC](https://community.auth0.com/t/block-all-users-unless-accepted/106154/1 "2023-05-04T11:19:06Z")

</div>

In my application, I want no user to be able to log in via auth0. Unless i accept their application.

So what I want is pretty much a list that says:  
“this is the people that want to have an account on this site”  
And then I could accept or deny it.

Is their anything that can do this?

I already have everything protected for is unauthenticated users. But the problem is that anyone can create an account and therefore access my website.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 5, 2023, 12:37am UTC](https://community.auth0.com/t/block-all-users-unless-accepted/106154/3 "2023-05-05T00:37:36Z")

</div>

Hi @emy,

Thanks for reaching out to the Auth0 Community!

> [@emy](#):
>
> In my application, I want no user to be able to log in via auth0. Unless i accept their application.
> 
> So what I want is pretty much a list that says:  
> “this is the people that want to have an account on this site”  
> And then I could accept or deny it.

Firstly, there are a couple of ways to approach this.

To start, you could write an Auth0 Action script that allows users to log into your application only if you have accepted their application.

To do so, you could leverage the `user_metadata` property to set **true** or **false** whenever you have accepted their application by calling the [Management API’s Update a user endpoint](https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id).

Then on login, use a Post-Login Action script to check the value of `user_metadata.application` to allow or deny access accordingly.

For example:

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (!event.user.user_metadata.application) {
    api.access.deny(`Access to ${event.client.name} is not allowed.`);
  }
};

```

Alternatively, you could create a database with **sign ups disabled** and [invite your users to your application.](https://auth0.com/docs/customize/email/send-email-invitations-for-application-signup) This way, you can skip the complexity of assessing which user you would like to allow or deny access to your application and guarantee the users you invite are only the users allowed to access your application.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/b/2b194daeb7ab95fe161ddb893342367cbe80e12c.png)

I hope the explanation was clear!

Please let me know if you have any questions.

Thanks,  
Rueben

---

<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:** [May 19, 2023, 12:38am UTC](https://community.auth0.com/t/block-all-users-unless-accepted/106154/4 "2023-05-19T00:38:34Z")

</div>

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