# I'm looking for a way to manually authorize users

**URL:** <https://community.auth0.com/t/im-looking-for-a-way-to-manually-authorize-users/133538>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [May 6, 2024, 11:54pm UTC](https://community.auth0.com/t/im-looking-for-a-way-to-manually-authorize-users/133538 "2024-05-06T23:54:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nepimentel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nepimentel/32/56788_2.png) [@nepimentel](https://community.auth0.com/u/nepimentel)\
**Post date:** [May 6, 2024, 11:54pm UTC](https://community.auth0.com/t/im-looking-for-a-way-to-manually-authorize-users/133538/1 "2024-05-06T23:54:33Z")

</div>

I want to be able to authorize users manually, that is, they create their account, verify their email, but at that point have a way to give them approval so they can log in.

---

<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 7, 2024, 12:12am UTC](https://community.auth0.com/t/im-looking-for-a-way-to-manually-authorize-users/133538/3 "2024-05-07T00:12:10Z")

</div>

Hey @nepimentel welcome to the community!

> [@nepimentel](#):
>
> but at that point have a way to give them approval so they can log in.

You should be able to achieve this by utilizing a user’s [metadata](https://auth0.com/docs/manage-users/user-accounts/metadata) and an action to check it. Something like the following:

Set `isApproved` metadata in a [Pre User Registration Action](https://auth0.com/docs/customize/actions/flows-and-triggers/pre-user-registration-flow):

```auto
exports.onExecutePreUserRegistration = async (event, api) => {
  // Set the initial approval status to false
  api.user.setUserMetadata('isApproved', false);
};

```

Check metadata in a [Post Login Action](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow) when a user goes to log in:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const isApproved = event.user.user_metadata?.isApproved;

  // If the isApproved flag is not true, block the login
  if (isApproved !== true) {
    api.access.deny('Your account has not been approved yet.');
  }
};

```

You can either update a user’s metadata using the Auth0 Dashboard or the [Management API](https://auth0.com/docs/api/management/v2/users/patch-users-by-id) to manually authorize users.

---

<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 21, 2024, 12:12am UTC](https://community.auth0.com/t/im-looking-for-a-way-to-manually-authorize-users/133538/4 "2024-05-21T00:12:47Z")

</div>

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