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 ???
Hey there @jithinp968 welcome to the community!
Great to know things are working good for you!
There are several ways you can go about this depending on the specific use case, but to outline a few options:
- Using 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):
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 wherein you add logic directly to the login script 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!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.