# Insufficient scope, expected any of: read:roles

**URL:** <https://community.auth0.com/t/insufficient-scope-expected-any-of-read-roles/80955>\
**Category:** Get Help\
**Tags:** scope, auth0\
**Created:** [April 1, 2022, 10:35am UTC](https://community.auth0.com/t/insufficient-scope-expected-any-of-read-roles/80955 "2022-04-01T10:35:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![selvi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/selvi/32/33945_2.png) [@selvi](https://community.auth0.com/u/selvi)\
**Post date:** [April 1, 2022, 10:35am UTC](https://community.auth0.com/t/insufficient-scope-expected-any-of-read-roles/80955/1 "2022-04-01T10:35:38Z")

</div>

How to add scope for specific application via dashboard in auth0? Trying to get roles with permission using management library. But when hit it getting below error. Attached rule script below. Commented the code for permission, and verified the access token response the scope doesn’t contains read:roles. How do I add it? Help me to resolve this!  
Error:  
` (node:18) UnhandledPromiseRejectionWarning: APIError: {"statusCode":403,"error":"Forbidden","message":"Insufficient scope, expected any of: read:roles","errorCode":"insufficient_scope"}`

// code

```auto
 const assignedRoles = context.authorization ? context.authorization.roles : null;
  
   var roleId = "rol_Xh28p7lUK0PYVd9o";
    const roleWithPermissions = await management.getPermissionsInRole(roleId);
   management.getPermissionsInRole(params, function (err, permissions) {
      console.log(permissions);
   });
    console.log(roleWithPermissions);

```

// response

> {“access\_token”:“eyJhbGMYtAK2qAIcEGot4Rx5mx9-agW6SfWgjZDaHofY1EHZWQhhIoPohHjpyPim5-poA4qqUJXb4ABfambIzGVFJVkP9sfJwnTPTDBHRlWiQ5u8ENakq0FomfuMrmCnVPSJKIYoUCQRlPQFLnLcxFxqvQtgmAW8yXxTyFrFKhmJ5tGdLEXxDyKVlha02IF59MFWUBxT41a2cw”,“scope”:“read:current\_user update:current\_user\_metadata delete:current\_user\_metadata create:current\_user\_metadata create:current\_user\_device\_credentials delete:current\_user\_device\_credentials update:current\_user\_identities”,“expires\_in”:86400,“token\_type”:“Bearer”}

---

<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:** [April 1, 2022, 1:27pm UTC](https://community.auth0.com/t/insufficient-scope-expected-any-of-read-roles/80955/3 "2022-04-01T13:27:40Z")

</div>

Hi @selvi,

You can update an application’s Management API permissions in the dashboard under the API’s M2M settings.

Click the dropdown arrow to read and updates permissions:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/8/1/81a0e66bac956c0e24a09b24b2800fe55c3efbd1.png)

---

<div class="post-metadata">

**Author:** ![selvi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/selvi/32/33945_2.png) [@selvi](https://community.auth0.com/u/selvi)\
**Post date:** [April 4, 2022, 5:11am UTC](https://community.auth0.com/t/insufficient-scope-expected-any-of-read-roles/80955/4 "2022-04-04T05:11:15Z")

</div>

Updated the permission under System API. Added below rules to get permission for certain role. But still getting the Same error. Attached the below error

// code

> var roleId = “rol\_Xh28p7lUK0PYVd9o”;  
> const roleWithPermissions = await management.getPermissionsInRole(roleId);

Error:

```auto
(node:18) UnhandledPromiseRejectionWarning: APIError: {"statusCode":403,"error":"Forbidden","message":"Insufficient scope, expected any of: read:roles","errorCode":"insufficient_scope"} at /data/_verquire/_node12/auth0-extension-s3-tools/1.1.1/node_modules/rest-facade/src/Client.js:387:27 at Request.callback (/data/_verquire/_node12/auth0-extension-s3-tools/1.1.1/node_modules/rest-facade/node_modules/superagent/lib/node/index.js:728:3) at /data/_verquire/_node12/auth0-extension-s3-tools/1.1.1/node_modules/rest-facade/node_modules/superagent/lib/node/index.js:916:18 at Stream.<anonymous> (/data/_verquire/_node12/auth0-extension-s3-tools/1.1.1/node_modules/rest-facade/node_modules/superagent/lib/node/parsers/json.js:19:7) at Stream.emit (events.js:314:20) at Stream.EventEmitter.emit (domain.js:506:15) at Unzip.<anonymous> (/data/_verquire/_node12/auth0-extension-s3-tools/1.1.1/node_modules/rest-facade/node_modules/superagent/lib/node/unzip.js:55:12) at Unzip.emit (events.js:326:22) at Unzip.EventEmitter.emit (domain.js:506:15) at endReadableNT (_stream_readable.js:1241:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)

10:08:38 AM:

(node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:18) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

```

---

<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:** [April 4, 2022, 3:54pm UTC](https://community.auth0.com/t/insufficient-scope-expected-any-of-read-roles/80955/5 "2022-04-04T15:54:41Z")

</div>

Can you please DM me your tenant name and the name/client ID of the app that is requesting the token? Thanks!

---

<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:** [April 22, 2022, 12:04am UTC](https://community.auth0.com/t/insufficient-scope-expected-any-of-read-roles/80955/6 "2022-04-22T00:04:25Z")

</div>


