title: Unable to make LinkedIn API calls from localhost with Axios
body: <p>I am trying to access linkedin profile using axios get request, which doesn't work on localhost and I get the following error</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load
    <a href="https://api.linkedin.com/v1/people/~:(id,email-address)?format=json" rel="nofollow noreferrer">https://api.linkedin.com/v1/people/~:(id,email-address)?format=json</a>.
    Response to preflight request doesn't pass access control check: No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://localhost:8030" rel="nofollow noreferrer">http://localhost:8030</a>' is therefore not allowed
    access. The response had HTTP status code 401.</p>
  </blockquote>
  
  <p>I am able to get access-token using <a href="https://www.npmjs.com/package/react-linkedin-login" rel="nofollow noreferrer">react-linkedin-login</a> package, after getting the access token I am trying the following code</p>
  
  <pre><code>var linkedInUrl = `https://api.linkedin.com/v1/people/~:(id,email-address)?format=json`;
    var headers = {
      'Authorization': `Bearer ${accessToken}`,
      'Access-Control-Allow-Methods':'GET,PUT,PATCH,POST,DELETE',
      'Access-Control-Allow-Origin':'*',
      'Access-Control-Request-Headers':'Origin, X-Requested-With, Content-Type, Accept',
      'Content-Type':'application/x-www-form-urlencoded'
    };
  
    return (dispatch) =&gt; {
      axios.get(linkedInUrl, {headers}).then(({data}) =&gt; {
          console.log(data);
      }, (error) =&gt; {
          console.log(error);
      });
    }
  </code></pre>
  
  <p>The problems lies in linkedin server how it takes request I guess, it doesn't allow localhost to make call I think. How to overcome this to actually develop the service before I deploy and run on server.</p>
  
  <p>Thanks for helping.. </p>