# Role based access configuration?

**URL:** <https://community.auth0.com/t/role-based-access-configuration/113978>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [August 18, 2023, 6:42pm UTC](https://community.auth0.com/t/role-based-access-configuration/113978 "2023-08-18T18:42:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JessicaMulein](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jessicamulein/32/50035_2.png) [@JessicaMulein](https://community.auth0.com/u/JessicaMulein)\
**Post date:** [August 18, 2023, 6:42pm UTC](https://community.auth0.com/t/role-based-access-configuration/113978/1 "2023-08-18T18:42:37Z")

</div>

I’m trying to follow ChatGPT’s advice on how to get my custom roles listed in the JWT claims.  
I’ve added this to my login flow

> exports.onExecutePostLogin = async (event, api) =\> {  
> const namespace = ‘[https://dualitysocial.us.auth0.com/](https://dualitysocial.us.auth0.com/)’;
> 
> // Check if the user has roles in app\_metadata or user\_metadata  
> let roles = ;  
> if (event.user.app\_metadata && event.user.app\_metadata.roles) {  
> roles = event.user.app\_metadata.roles;  
> } else if (event.user.user\_metadata && event.user.user\_metadata.roles) {  
> roles = event.user.user\_metadata.roles;  
> }  
> console.log(event.user.app\_metadata.roles);  
> console.log(event.user.user\_metadata.roles);  
> console.log(roles);
> 
> // Append roles to the ID and/or Access Token  
> api.idToken.setCustomClaim(namespace + ‘roles’, roles);  
> api.accessToken.setCustomClaim(namespace + ‘roles’, roles);  
> };

But I can’t find where to enable RBAC- ChatGPT says it is under the API somewhere, but I can’t find it anywhere, and the user metadata is empty.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [August 18, 2023, 8:31pm UTC](https://community.auth0.com/t/role-based-access-configuration/113978/3 "2023-08-18T20:31:43Z")

</div>

Hi @JessicaMulein,

Welcome to the Auth0 Community!

You can enable this setting by going to your [_Auth0 Dashboard \> Applications \> API \> Your API_](https://manage.auth0.com/#/apis) and scrolling to the RBAC Settings section to switch on the Enable RBAC toggle.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/7/4/74597d24b5fa61200cf55896494bd651432ebef7.png)

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![JessicaMulein](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jessicamulein/32/50035_2.png) [@JessicaMulein](https://community.auth0.com/u/JessicaMulein)\
**Post date:** [August 18, 2023, 9:52pm UTC](https://community.auth0.com/t/role-based-access-configuration/113978/4 "2023-08-18T21:52:33Z")

</div>

Thank you. My problem was the default API doesn’t have this option but once I created a new one it was available.

---

<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:** [September 1, 2023, 9:52pm UTC](https://community.auth0.com/t/role-based-access-configuration/113978/5 "2023-09-01T21:52:35Z")

</div>

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