# Add permissions to access token in actions (September 2023, rules are deprecated)

**URL:** <https://community.auth0.com/t/add-permissions-to-access-token-in-actions-september-2023-rules-are-deprecated/117219>\
**Category:** Get Help\
**Tags:** management-api, roles\
**Created:** [September 27, 2023, 8:09am UTC](https://community.auth0.com/t/add-permissions-to-access-token-in-actions-september-2023-rules-are-deprecated/117219 "2023-09-27T08:09:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![finom](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/finom/32/44181_2.png) [@finom](https://community.auth0.com/u/finom)\
**Post date:** [September 27, 2023, 8:09am UTC](https://community.auth0.com/t/add-permissions-to-access-token-in-actions-september-2023-rules-are-deprecated/117219/1 "2023-09-27T08:09:16Z")

</div>

I’ve used Rules heavily to populate access token some extra information such as email and permissions. Yesterday I’ve noticed that Rules are deprecated and I need to switch to Actions. I’ve added email to the token easily with `api.accessToken.setCustomClaim(ns, event.user.email);` but I’m struggling with adding permissions to it. The instructions I found on this forum and instructions that provides ChatGPT4 tell me that I need to use Management API to make an additional request. Part of the code that I copied and pasted from the forums looks like that:

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

As you can see `event.secrets` does not provide the properties such as `clientSecret` and if you inspect the TypeScript definitions you’re going to notice that `Secrets` interface is actually completely empty:

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

Permissions is a critical part of multiple apps I work on and I’m trying to find out:

1. Permissions is one of the core features of Auth0, why there is no easy way to get them?
2. Why secrets object is gone if Actions allow you to call Management API? It’s not allowed anymore? Should I hard-code the secrets by myself inside variables loosing some part of flexibility and probably security?
3. If I still use Management API I’m going to get rate limit errors that need to be handled (I don’t know how to do that yet), is there any way to avoid using it at all?
4. Why it’s becoming harder and harder to work with permissions? Are they going to disappear soon?
5. Maybe I don’t understand something (the purpose of roles and permissions, the way they need to be received) and I need to find an alternative approach? The only but horrible alternative I can see is to call Management API on every internal API request to receive an actual list of permissions, but obviously I’m going to hit the rate limit error much sooner. Please direct me if I do it wrong.

Unfortunately I can’t recommend to use Auth0 to my clients since one of the core and important features is not available anymore. I hope you can help me to find a solution that allows to identify user’s permissions without getting an additional source of problems such as API limits that I haven’t got while I was using Rules. Thank you.

---

<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:** [September 28, 2023, 5:09pm UTC](https://community.auth0.com/t/add-permissions-to-access-token-in-actions-september-2023-rules-are-deprecated/117219/3 "2023-09-28T17:09:05Z")

</div>

Hi @finom

> [@finom](#):
>
> 1. Permissions is one of the core features of Auth0, why there is no easy way to get them?

You can add permissions in the access token by simply clicking the toggle **ON** for the “Add Permissions in the Access Token” setting. Please let me know if you need any clarification or if I can help you understand this feature.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/c/cc8e56bee7d6e33a8c549d51543939645878b20e.png)

> [@finom](#):
>
> 1. Why secrets object is gone if Actions allow you to call Management API? It’s not allowed anymore? Should I hard-code the secrets by myself inside variables loosing some part of flexibility and probably security?

I’m not sure what you mean by “Why secrets object is gone”. The secrets object is a customizable store for sensitive data, and you can add whatever data you want in a secret. It is a perfect place to store a client ID and secret. _You must add these properties (`client_id`, `client_secret`), they are not automatically configured in an Action._

See our documentation about [how to write your first action](https://auth0.com/docs/customize/actions/write-your-first-action#add-a-secret).

> [@finom](#):
>
> If I still use Management API I’m going to get rate limit errors that need to be handled (I don’t know how to do that yet), **is there any way to avoid using it at all?**

See answer #1.

> [@finom](#):
>
> Why it’s becoming harder and harder to work with permissions? Are they going to disappear soon?

No. Can you give an example of how they have changed?

> [@finom](#):
>
> Maybe I don’t understand something (the purpose of roles and permissions, the way they need to be received) and I need to find an alternative approach? The only but horrible alternative I can see is to call Management API on every internal API request to receive an actual list of permissions, but obviously I’m going to hit the rate limit error much sooner. Please direct me if I do it wrong.

I would not suggest calling the managment API on every authentication. This is not a scalable pattern.

As for your first questions, they are addressed in our documentation (how secrets work, adding permissions to the AT). I would start by taking a look at our docs.

> **[Write Your First Action](https://auth0.com/docs/customize/actions/write-your-first-action#add-a-secret)**
>
> Learn how to write an Action, which includes choosing a flow, creating an Action and configuring it, and binding it to the flow.

[https://auth0.com/docs/get-started/apis/enable-role-based-access-control-for-apis](https://auth0.com/docs/get-started/apis/enable-role-based-access-control-for-apis)

> [@finom](#):
>
> Unfortunately I can’t recommend to use Auth0 to my clients since one of the core and important features is not available anymore. I hope you can help me to find a solution that allows to identify user’s permissions without getting an additional source of problems such as API limits that I haven’t got while I was using Rules. Thank you.

Rules would have had the same issues with the management API rate limits. Management API calls from rules are still subject to rate limits.

---

<div class="post-metadata">

**Author:** ![finom](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/finom/32/44181_2.png) [@finom](https://community.auth0.com/u/finom)\
**Post date:** [September 30, 2023, 7:48am UTC](https://community.auth0.com/t/add-permissions-to-access-token-in-actions-september-2023-rules-are-deprecated/117219/4 "2023-09-30T07:48:53Z")

</div>

> You can add permissions in the access token by simply clicking the toggle **ON** for the “Add Permissions in the Access Token” setting. Please let me know if you need any clarification or if I can help you understand this feature.

🤦‍♂️ my bad… I was frustrated and too emotional after spending a lot of time on working with Actions to achieve a small thing (get permissions). When the system has problems it’s hard to identify if it’s your bad or system’s.

> I’m not sure what you mean by “Why secrets object is gone”.

They’re not available at Actions. The Secrets interface is empty, is there any way to enable it? All recommendations how to get permissions thru Management API in Actions aren’t doable because you have no way to get the credentials, at least until you enable some feature as with permissions.

> No. Can you give an example of how they have changed?

I was using Rules for that, so yeah, that’s still my bad.

---

<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:** [October 2, 2023, 1:56pm UTC](https://community.auth0.com/t/add-permissions-to-access-token-in-actions-september-2023-rules-are-deprecated/117219/5 "2023-10-02T13:56:32Z")

</div>

You can add a secret by clicking the key icon in the left hand menu bar, and selecting “Add Secret”.

 ![Screenshot 2023-10-02 at 9.55.36 AM](https://global.discourse-cdn.com/auth0/original/3X/6/9/69318379f3734c0f8f0bc337472c465eca46d9f3.png)

---

<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:** [October 16, 2023, 1:57pm UTC](https://community.auth0.com/t/add-permissions-to-access-token-in-actions-september-2023-rules-are-deprecated/117219/6 "2023-10-16T13:57:13Z")

</div>

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