Getting issue while adding a default role while sign up

I have followed block at ,however I am getting below error while adding a role during login

ManagementApiError: Invalid token
at UsersManager.parseError (/data/layers/layers-GH-v/GH-vlzQIts7oMVQoMATHHepPqgU7LvJnMmf-9-IHPrA/node_modules/auth0/dist/cjs/management/management-client.js:33:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async UsersManager.request (/data/layers/layers-GH-v/GH-vlzQIts7oMVQoMATHHepPqgU7LvJnMmf-9-IHPrA/node_modules/auth0/dist/cjs/lib/runtime.js:119:23)
at async UsersManager.assignRoles (/data/layers/layers-GH-v/GH-vlzQIts7oMVQoMATHHepPqgU7LvJnMmf-9-IHPrA/node_modules/auth0/dist/cjs/management/__generated/managers/users-manager.js:601:26)
at async exports.onExecutePostLogin (/data/io/node18-actions/48d8c54a-0146-4d23-a14a-28877044b3f8/webtask.js:22:5)
at async /data/io/43b2cb4453c30fe82f751c8a7ea2ccf74ed76dcc.js:7:901 {

Hi @vinayppuria

Welcome to the Auth0 Community!

Thank you for posting your question. I’ll respond as soon as I have more information regarding your case.


I just encountered this same error. The solution is the same as Get Auth0 Management API invalid token error

That video glosses over the Management API permissions section, and the blog post that accompanies the video does not mention ensuring that your application has the right management api permissions at all

The general solution is making sure that the Auth0 Application associated with the Client ID that is used in the Action has the appropriate Management API Permissions.

  1. Go to Applications → APIs → Auth0 Management API
  2. Click on Machine to Machine Applications
  3. Go to the Application that has the ClientID of the Client you put in Secrets
  4. Make sure that the Authorized slider is green,
  5. Twist open the chevron
  6. Select the Permission that is required. In this case for adding a role to a user you’ll want update:users