# Adding user permission to the id-token

**URL:** <https://community.auth0.com/t/adding-user-permission-to-the-id-token/102853>\
**Category:** Get Help\
**Tags:** user-management, management-api, roles\
**Created:** [March 18, 2023, 9:40pm UTC](https://community.auth0.com/t/adding-user-permission-to-the-id-token/102853 "2023-03-18T21:40:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stehranchi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stehranchi/32/45581_2.png) [@stehranchi](https://community.auth0.com/u/stehranchi)\
**Post date:** [March 18, 2023, 9:40pm UTC](https://community.auth0.com/t/adding-user-permission-to-the-id-token/102853/1 "2023-03-18T21:40:13Z")

</div>

Hi  
I’ve got a react application and a backend project which exposes some APIs.  
I’ve assigned some roles to the users and some permissions to those roles. I have access to the permissions in my access token, so the backend project can authorize the user based on the permissions. But I need those permissions in the SPA too. For example the user should not be able to see the “edit post” button if he doesn’t have post:edit permission.  
Of course I can parse the access token payload in the SPA and get the permissions from that, but this is not a good practice. Now I’ve two questions:

1. Is there a way to add permissions to the id token? (e.g. Via actions or any other way)
2. Is there a special reason that this is not the default behaviour of the system, because I think it is not a rare use-case.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 23, 2023, 4:09pm UTC](https://community.auth0.com/t/adding-user-permission-to-the-id-token/102853/3 "2023-03-23T16:09:53Z")

</div>

Hi @stehranchi,

Welcome to the Auth0 Community!

There are quite a few posts in the forum about this:

[https://community.auth0.com/t/how-to-add-roles-and-permissions-to-the-id-token-using-actions/84506](https://community.auth0.com/t/how-to-add-roles-and-permissions-to-the-id-token-using-actions/84506)

> [@How to add user permissions to ID token](https://community.auth0.com/t/how-to-add-user-permissions-to-id-token/88714):
>
> Hey community. From our single-page application, we want to know the current user’s permission so we can control access to certain sections or buttons of our app. We’re using organizations. As you’re probably aware, permissions are assigned to roles. Users, in my understanding, can be assigned to roles within the context of organizations and can also be assigned to roles directly (outside the context of organizations). Because of this, we essentially need the union of permissions from (1) all t…

> [@Adding Scopes/Permissions to ID Token](https://community.auth0.com/t/adding-scopes-permissions-to-id-token/75705):
>
> Hi, As a followup to this topic: Is there any official documentation or reference to how User Permissions can be appended to ID Tokens? The linked topic contains another link to a code snippet generously added by @ryantomaselli: And while this snippet looks like it may be a solution, it’s definitely not something I would consider official documentation. I would expect to see a working Rule code snippet, as well as instructions on how such a Rule should be added to the Auth Pipeline. Is…

---

<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:** [April 6, 2023, 4:10pm UTC](https://community.auth0.com/t/adding-user-permission-to-the-id-token/102853/4 "2023-04-06T16:10:31Z")

</div>

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