I am trying to use axios method in my serverless app for API call to third party system. But its giving me error when I am adding it server.js
const axios = require(“axios”);
var token = await axios.post(
this.url + “auth/oauth/token”,
grant_type=password&username=test&password=test,
{
headers: {
Authorization: "Basic " + Buffer.from(“public-client:public”, “utf8”).toString(“base64”)
}
}
);
Manifest.json file
“dependencies”: {
“axios”: “1.2.1”,
“safe-buffer” : “5.2.1”,
}
Error [Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ]
I have tried to call API using $request.post method. But don’t know the syntax, how to add grant type parameter to it. Any one please suggest.


