# Permissions assigned through RBAC do not match currently assigned roles

**URL:** <https://community.auth0.com/t/permissions-assigned-through-rbac-do-not-match-currently-assigned-roles/128577>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [February 29, 2024, 4:55am UTC](https://community.auth0.com/t/permissions-assigned-through-rbac-do-not-match-currently-assigned-roles/128577 "2024-02-29T04:55:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![barry.schwarz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/barry.schwarz/32/48842_2.png) [@barry.schwarz](https://community.auth0.com/u/barry.schwarz)\
**Post date:** [February 29, 2024, 4:55am UTC](https://community.auth0.com/t/permissions-assigned-through-rbac-do-not-match-currently-assigned-roles/128577/1 "2024-02-29T04:55:53Z")

</div>

I have a Rule that assigns a default role to a user on their initial login. For some users, additional roles were granted after the initial login. The application/api is configured so permissions for assigned roles are automatically added to the access token. It looks like only permissions for the initial role are in the access token. If I look in the Rule the context.authorization.roles array contains only the initial role. If I look in an Action, the event.authrization.roles array contains only the initial role.

The initial role configuration seems to stick even if I delete all roles.

How do I get the access token generator to recognize the set of roles currently granted to the user?

---

<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:** [February 29, 2024, 8:58pm UTC](https://community.auth0.com/t/permissions-assigned-through-rbac-do-not-match-currently-assigned-roles/128577/3 "2024-02-29T20:58:54Z")

</div>

Hi @barry.schwarz,

Welcome to the Auth0 Community!

It looks like you’re encountering an error outlined [here](https://community.auth0.com/t/roles-custom-claim-is-empty-after-roles-are-set-on-user-creation-via-auto-import/108251). Essentially, when you use the Management API from an Action to modify the current user, it updates the user’s profile but not the event object. This means any changes to the profile won’t be visible until the user logs in again.

One workaround for this scenario is to get the permissions at the same time you assign the user to the role. To do this, use the `managementClient.users.getPermissions()` method.

(Reference [UsersManager | auth0](https://auth0.github.io/node-auth0/classes/management.UsersManager.html#getPermissions))

Please let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![barry.schwarz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/barry.schwarz/32/48842_2.png) [@barry.schwarz](https://community.auth0.com/u/barry.schwarz)\
**Post date:** [February 29, 2024, 9:13pm UTC](https://community.auth0.com/t/permissions-assigned-through-rbac-do-not-match-currently-assigned-roles/128577/4 "2024-02-29T21:13:23Z")

</div>

This could be part of the problem. What I’m seeing is the initial role is setup. I don’t know what that token looked like. After that, I can change roles and issue new tokens but the context.authorization.roles field does not change and the permissions in the access token do not change.

---

<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:** [March 5, 2024, 1:11am UTC](https://community.auth0.com/t/permissions-assigned-through-rbac-do-not-match-currently-assigned-roles/128577/5 "2024-03-05T01:11:02Z")

</div>

Hi @barry.schwarz,

Thanks for the reply.

I would assume that when you assign the initial role on the user’s first login, the initial token issued would not contain details about the user’s role or permissions until their subsequent login.

If you make any changes to the roles, you will need to issue a new token.

As mentioned previously, a workaround is to set the Roles and Permissions directly to the access token at the same time as a custom claim just to get around this issue.

Let me know if you need help with implementation.

---

<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:** [March 19, 2024, 1:11am UTC](https://community.auth0.com/t/permissions-assigned-through-rbac-do-not-match-currently-assigned-roles/128577/6 "2024-03-19T01:11:37Z")

</div>

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