Role Based-Access Control on Signup?

I have been following this auth0 tutorial and it goes over how to implement role based access control to an API’s endpoints. In the tutorial, the way to assign an admin role is by using the auth0 dashboard itself - by creating a User and then assigning that the admin role to that user within the auth0 dashboard. I want certain users to be able to access certain endpoints based on their role.

I was wondering if there was a way to assign admin roles to users during the signup phase? That way I wouldn’t have to go into the dashboard to change each user to be an admin.

Hi @chu08888,

You can add roles to users when they sign up by using a rule. Rules are javascript functions that run after a user logs in.

Here’s an FAQ that shows you how to add a default role: How do I add a default role to a new user on first login?

You can just add the role to certain users by checking an array of users like in this example: Auth0 IP Addresses for Allow Lists

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