Auth0 Home Blog Docs

How to automatically add roles and permissions to a user using authorization-extension



Hii…In my application there is a field called roles in which the user specify his roles as(Doctor,pharmacist or patient),I created a additional custom signup field in auth0 and now user_metadata of the user is updated with the roles he specifies in UI. Also I created a new authorization extension in which I created Roles and certain permissions are added to it (eg:update:discharge for Doctor).Now my question are as follows

  1. how to assign the roles in authorization-extension based on the user_metadata of the user ?
    2)how does the permissions under specific roles should be populated and updated in app_metadata of the user

Note:Everything is working fine when I do it manually like, when a user registers I’m going into authorization extension and adding roles to that user,so after logging in once the app_metadata is updated with roles and permissions.

So how to do it automatically,once the user login, based on the roles he specified in UI,it should equate it with authorization extension roles and the permission along with it should be updated in app_metadata of the user.

Any help is appreciated. Thanks!


@lavanya.anand Were you able to figure this out? I’m stuck on the same issue right now.


Hii jackrvaughan…No actually I didnt get rid of this…So I changed my application flow…And for now I’m not using this authorization extension…Waiting for the solution