# How to create a RBAC rule based on user roles

**URL:** <https://community.auth0.com/t/how-to-create-a-rbac-rule-based-on-user-roles/64514>\
**Category:** Get Help\
**Tags:** rules, rbac\
**Created:** [June 15, 2021, 10:36am UTC](https://community.auth0.com/t/how-to-create-a-rbac-rule-based-on-user-roles/64514 "2021-06-15T10:36:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthick.vankayala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/karthick.vankayala/32/12789_2.png) [@karthick.vankayala](https://community.auth0.com/u/karthick.vankayala)\
**Post date:** [June 15, 2021, 10:36am UTC](https://community.auth0.com/t/how-to-create-a-rbac-rule-based-on-user-roles/64514/1 "2021-06-15T10:36:18Z")

</div>

How to create a rule that is based on user’s role where the role is created within Auth0. This role assignment is not adding up to users metadata.

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [June 15, 2021, 1:10pm UTC](https://community.auth0.com/t/how-to-create-a-rbac-rule-based-on-user-roles/64514/3 "2021-06-15T13:10:38Z")

</div>

Hi @karthick.vankayala,

Welcome to the Community!

When you use Auth0 Authorization Core (i.e., assign roles in the dashboard), you can access the user’s roles in rules with `context.authorization.roles` ([Sample Use Cases: Rules with Authorization](https://auth0.com/docs/authorization/sample-use-cases-rules-with-authorization#add-user-roles-to-tokens)).

You may want to consider using a post-login Action instead, in which case you can use `event.authorization.roles`

> **[Login Flow](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow)**
>
> Learn about the Actions Login Flow and the post-login Action trigger, which is executed after a user logs in and when a Refresh Token is requested.

---

<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:** [January 8, 2024, 9:06am UTC](https://community.auth0.com/t/how-to-create-a-rbac-rule-based-on-user-roles/64514/4 "2024-01-08T09:06:46Z")

</div>

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