title: Calling a not CORS enabled API from node or react
body: <p>I'm trying to call a MicroStrategy API from a react app, or a node backend, but i get a 401 unauthorized error back.</p>
  
  <p>When running in postman or chrome (just pasting the url into the address bar), i get a status 200 response with an access token. Postman then generates the following nodejs code:</p>
  
  <pre><code>var request = require("request");
  
  var options = { method: 'GET',
    url: 'http://*/MicroStrategy/asp/TaskAdmin.aspx',
    qs: 
     { taskId: 'getSessionState',
       taskEnv: 'xml',
       taskContentType: 'xml',
       server: '*',
       project: '*',
       uid: '*',
       pwd: '*' },
    headers: 
     { 'postman-token': '9c7f6ca8-1ae4-b296-17cf-d850369cbad4',
       'cache-control': 'no-cache' } };
  
  request(options, function (error, response, body) {
    if (error) throw new Error(error);
  
    console.log(body);
  });
  </code></pre>
  
  <p>This code results in 401 error.</p>
  
  <p>When trying the same from the client side (with react and axios), chrome throws the following error: </p>
  
  <pre><code>No 'Access-Control-Allow-Origin' header is present on the requested 
  resource. Origin 'http://localhost:3000' is therefore not allowed access. 
  The response had HTTP status code 401.
  </code></pre>
  
  <p>The problem is not the browser blocking CORS, it's the MicroStrategy server blocking the request, possibly because it has an 'Origin' header. Is there a way to make the exact same request in node as in postman? </p>