Problem described in title. Here is my code:
var request = require("request");
var options = {
method: 'POST',
url: `https://${MGMT_DOMAIN}/api/v2/tickets/password-change`,
headers: { 'Content-Type': 'application/json', "Authorization": `Bearer ${access_token}` },
body: `{"connection_id": "${connection_id}", "email": "${email}"}`
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
I’ve double checked all of the variables (MGMT_DOMAIN, access_token, connection_id). I don’t know what I’m doing wrong. I’ve also tried using the nodejs ManagementClient api instead, with the same error:
const management = new ManagementClient({
domain: MGMT_DOMAIN,
token: access_token
});
management.createPasswordChangeTicket({
email,
connection_id
})
.then(console.log)
.catch(console.error)
I’ve also tried without directly specifying the token, using:
const management = new ManagementClient({
domain: MGMT_DOMAIN,
clientId: MGMT_ID,
clientSecret: MGMT_SECRET
});
with the same error. The API I am using is the default Auth0 Management API, so I am not sure what I’m doing wrong. I know I haven’t messed up the secrets/ids because I can call management.getAccessToken()
just fine.
Edit: I managed to get it to work with the access token, but I need it to work with just providing the clientId and clientSecret and domain, so that I can use it with Auth0 Actions