# Login only for specific users

**URL:** <https://community.auth0.com/t/login-only-for-specific-users/112335>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [July 28, 2023, 9:37am UTC](https://community.auth0.com/t/login-only-for-specific-users/112335 "2023-07-28T09:37:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jithinp968](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jithinp968/32/49394_2.png) [@jithinp968](https://community.auth0.com/u/jithinp968)\
**Post date:** [July 28, 2023, 9:37am UTC](https://community.auth0.com/t/login-only-for-specific-users/112335/1 "2023-07-28T09:37:11Z")

</div>

I want to login some specific users only.how can i implement that. I go through all the documentation and i couldn’t find anything.  
I created reactJs SPA and implemented authentication successfully with @auth0/auth0/react and login done with popup its working perfect. but its like any users can login that is not i want. maybe it sound dumb maybe its my logic idk… I just want to login some specific role users only. anyone help ???

---

<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:** [August 2, 2023, 11:56pm UTC](https://community.auth0.com/t/login-only-for-specific-users/112335/3 "2023-08-02T23:56:14Z")

</div>

Hey there @jithinp968 welcome to the community!

> [@jithinp968](#):
>
> I created reactJs SPA and implemented authentication successfully with @auth0/auth0/react and login done with popup its working perfect.

Great to know things are working good for you!

> [@jithinp968](#):
>
> I just want to login some specific role users only.

There are several ways you can go about this depending on the specific use case, but to outline a few options:

- Using [Actions](https://auth0.com/docs/customize/actions): You can allowlist how’d you like from within an Action - Some options are email domain, Roles, or even individual users. An example of what this might look like (domain allowlist):

```auto
exports.onExecutePostLogin = async (event, api) => {
  const allowList = ['example.com', 'example.org']; // authorized domains
  const emailSplit = event.user.email.split('@');
  const domain = emailSplit[emailSplit.length - 1].toLowerCase();
  
  if (!allowList.includes(domain)) {
    api.access.deny('Access denied.');
  }
};

```

- Use a [custom database connection](https://auth0.com/docs/authenticate/database-connections/custom-db/create-db-connection) wherein you add logic directly to the [login script](https://auth0.com/docs/authenticate/database-connections/custom-db/templates/login) for the database.

- Lastly, you could always implement logic in your own app.

Hope this helps to at least give you some ideas as to what’s possible!

---

<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:** [August 24, 2023, 1:05am UTC](https://community.auth0.com/t/login-only-for-specific-users/112335/4 "2023-08-24T01:05:16Z")

</div>

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