thank u, it seems to be a perfect solution but some new problems spawned , i copied ur code in a new custom action.
i created a new application with type m2m to allow client_credential grant_type.
in the application settings in the apis section i’ve allowed the required permisisons.
in the custom action, i’ve used client secret and client id from the new m2m application.
from the log the error now is:
Bad Request: Invalid request payload input
at /data/_verquire/_node16/@auth0/rule-utilities/0.2.0/node_modules/rest-facade/src/Client.js:402:25
at Request.callback (/data/_verquire/_node16/@auth0/rule-utilities/0.2.0/node_modules/superagent/lib/node/index.js:905:3)
at /data/_verquire/_node16/@auth0/rule-utilities/0.2.0/node_modules/superagent/lib/node/index.js:1126:20
at IncomingMessage.<anonymous> (/data/_verquire/_node16/@auth0/rule-utilities/0.2.0/node_modules/superagent/lib/node/parsers/json.js:22:7)
at IncomingMessage.emit (node:events:539:35)
at IncomingMessage.emit (node:domain:537:15)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
statusCode: 400,
requestInfo: {
method: 'post',
url: 'https://server21.us.auth0.com/api/v2/users/auth0|642d799ca91c546d0a2a378b/roles'
},
originalError: Error: Bad Request
at Request.callback (/data/_verquire/_node16/@auth0/rule-utilities/0.2.0/node_modules/superagent/lib/node/index.js:883:15)
at /data/_verquire/_node16/@auth0/rule-utilities/0.2.0/node_modules/superagent/lib/node/index.js:1126:20
at IncomingMessage.<anonymous> (/data/_verquire/_node16/@auth0/rule-utilities/0.2.0/node_modules/superagent/lib/node/parsers/json.js:22:7)
at IncomingMessage.emit (node:events:539:35)
at IncomingMessage.emit (node:domain:537:15)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
status: 400,
response: Response {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
res: [IncomingMessage],
request: [Request],
req: [ClientRequest],
text: '{"statusCode":400,"error":"Bad Request","message":"Invalid request payload input"}',
body: [Object],
files: undefined,
buffered: true,
headers: [Object],
header: [Object],
statusCode: 400,
status: 400,
statusType: 4,
info: false,
ok: false,
redirect: false,
clientError: true,
serverError: false,
error: [Error],
created: false,
accepted: false,
noContent: false,
badRequest: true,
unauthorized: false,
notAcceptable: false,
forbidden: false,
notFound: false,
unprocessableEntity: false,
type: 'application/json',
charset: 'utf-8',
links: {},
setEncoding: [Function: bound ],
redirects: [],
pipe: [Function (anonymous)],
[Symbol(kCapture)]: false
}
}
}
thanks in advice
davide