79088974

Date: 2024-10-15 08:16:25
Score: 0.5
Natty:
Report link

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);
      });
Reasons:
  • Blacklisted phrase (1): how to solve
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Adrian Romero