Let me show how to solve it:
const axios = require('axios');
const { default: addOAuthInterceptor } = require("axios-oauth-1.0a");
let data = {sample:'data'};
data_header = JSON.stringify(data);
const client = axios.create();
const options = {
algorithm: 'HMAC-SHA256',
key: 'XXXXXXXXXXXXXXXXXX',
realm:'XXXXXXXXXXX',
secret: 'XXXXXXXXXXXXXXXXXXXXXX',
token: 'XXXXXXXXXXXXXXXXXXXXXXX',
tokenSecret: 'XXXXXXXXXXXXXXXXXXXXXX'
};
addOAuthInterceptor(client,options);
var config = {
method: "post",
url:
"https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
headers: {
"Content-Type": "application/json"
},
data: data_header
};
client(config).then((res) => {
console.log("data", res.data);
});