# API RBAC, Auth0 Actions, RWA

**URL:** <https://community.auth0.com/t/api-rbac-auth0-actions-rwa/83772>\
**Category:** Get Help\
**Created:** [May 20, 2022, 1:30am UTC](https://community.auth0.com/t/api-rbac-auth0-actions-rwa/83772 "2022-05-20T01:30:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![milotis](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/milotis/32/33224_2.png) [@milotis](https://community.auth0.com/u/milotis)\
**Post date:** [May 20, 2022, 1:30am UTC](https://community.auth0.com/t/api-rbac-auth0-actions-rwa/83772/1 "2022-05-20T01:30:08Z")

</div>

I found somes resources that describe adding Roles and Permissions using Auth0 actions and customizing the scope of jwtAuthz, which I wonder if I can use as a solution to secure an API endpoint, but I haven’t had a chance to test this yet. I came across this stuff when attempting to figure out how to get an API access token with roles/permissions for a user with an Auth0 Regular Web Application.

> **[Sample Use Cases: Actions with Authorization](https://auth0.com/docs/manage-users/access-control/sample-use-cases-actions-with-authorization)**
>
> Learn how to use Actions with roles-based access control (RBAC).

> [@Actions to get permissions](https://community.auth0.com/t/actions-to-get-permissions/66159):
>
> hi everyone. I have the following piece of code in an Action that is triggered during post-login: exports.onExecutePostLogin = async (event, api) =\> { var map = require('array-map'); var ManagementClient = require('auth0').ManagementClient; var management = new ManagementClient({ domain: event.secrets.domain, clientId: event.secrets.clientId, clientSecret: event.secrets.clientSecret }); var params = { id: event.user.user\_id, page: 0, per\_page: 50, include\_totals: …

> [@Custom scopes inside access token](https://community.auth0.com/t/custom-scopes-inside-access-token/30617):
>
> I have been following the steps described in this tutorial: [API and SPA Configuration (SPAs + API)](https://auth0.com/docs/architecture-scenarios/spa-api/part-3) At some point, I have configured an API, created roles, attached permissions and created a test user. My access token now contains something like this: { "iss": "my-tenant", "sub": "...", "aud": ["my-audience",], "iat": 1568059650, "exp": 1568146050, "scope": "openid email profile", "gty": "password", "permissions": ["read:something", "write:something"] } I w…

[![](https://global.discourse-cdn.com/auth0/original/3X/0/f/0f41d451a435069b7e79b360df7a376d5f292ee8.jpeg "Role Based Authentication in NodeJS with ExpressJS and Auth0") ](https://www.youtube.com/watch?v=_MW113gd2ho)

> [@Regular Web App with RBAC](https://community.auth0.com/t/regular-web-app-with-rbac/43966/2):
>
> Hey there! Yep we don’t have anything specific for Ruby on Rails but have you checked our general step by step docs on enabling RBAC?

---

<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:** [May 26, 2022, 9:11pm UTC](https://community.auth0.com/t/api-rbac-auth0-actions-rwa/83772/3 "2022-05-26T21:11:14Z")

</div>

Hi @milotis,

Thanks for reaching out to the Auth0 Community!

> [@milotis](#):
>
> I found somes resources that describe adding Roles and Permissions using Auth0 actions and customizing the scope of jwtAuthz, which I wonder if I can use as a solution to secure an API endpoint,

Yes, please see [this](https://community.auth0.com/t/how-do-i-assign-permissions-to-users/72278) FAQ on how to accomplish RBAC for your application.

Please let me know if you have any questions.

Thank you.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 21, 2022, 5:14pm UTC](https://community.auth0.com/t/api-rbac-auth0-actions-rwa/83772/4 "2022-12-21T17:14:29Z")

</div>


