title: CORS blocks LinkedIn share API
body: <p>I try to post new content using LinkedIn share API through JavaScript from AngularJS application as given below.</p>
  
  <pre><code>var xml = "&lt;share&gt;&lt;comment&gt;" + content + "&lt;/comment&gt;&lt;visibility&gt;&lt;code&gt;anyone&lt;/code&gt;&lt;/visibility&gt;&lt;/share&gt;";
  
  var req = {
     method: 'POST',
     url: 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=' + account.token,
     headers: {
         'Content-Type': 'text/plain'
     },
     data: xml
  };
  
  $http(req).success(function(data) {
     console.log(data);
     console.log('published to linkedin');
  }).error(function() {
     console.log(arguments);
     console.log('failed to publish to linkedin');
  });
  </code></pre>
  
  <p>I can successfully POST this data. However the browser blocks the response from being read because the response doesn't have an 'Access-Control-Allow-Origin' header.</p>
  
  <p><img src="https://i.stack.imgur.com/Ggr2H.png" alt="Access-Control-Allow-Origin"></p>
  
  <p>But, I have given the <code>http://localhost:3000</code> and '<a href="https://localhost:3000" rel="nofollow noreferrer">https://localhost:3000</a>' domains in LinkedIn application settings.</p>
  
  <p><img src="https://i.stack.imgur.com/kM79F.png" alt="LinkedIn Application Settings"></p>
  
  <p>And the request/response in Chrome looks like this.</p>
  
  <p><img src="https://i.stack.imgur.com/w5Je5.png" alt="Failing request response"></p>
  
  <p>Any thoughts on how to be able to read the response and not let the browser block it?</p>
  
  <p>I think the problem is the missing <code>Access-Control-Allow-Origin</code> header in the LinkedIn API response?</p>