Hi @VP003,
Welcome to the Auth0 Community!
I understand your Action script is not returning any response.
After looking through your code, I noticed that the data you are passing seems to be literal strings, namely “username” and “password”. In this case, I suggest that you store the data as Action Secrets.
Besides that, I did not find anything that stands out to be an issue. However, I suggest that you check whether your API request requires more than just supplying the data, such as defining the headers.
I would strongly suggest following this skeleton for making API calls with Axios:
var axios = require("axios").default;
var options = {
method: 'POST',
url: 'https://YOUR_URL',
headers: {'content-type': 'application/json'},
data: {
username: event.secrets.USERNAME,
password: event.secrets.PASSWORD
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Alternatively, you could export the Axios code using Postman and implement it that way into your Action script. To do so, click on the Code Snippet icon located on the right column of the application. Then clicking on the drop-down menu, select NodeJs -Axios
. See below:
Please let me know if there’s anything else I can do to help.
Thank you.