title: Reactjs with Laravel REST API: No 'Access-Control-Allow-Origin' header is present on the requested resource
body: <p>So I have a project that I am creating with ReactJS. 
  I am trying to Log In, and this is my React Code: </p>
  
  <pre><code>handleClick(event){
  var apiBaseUrl = "http://127.0.0.1:8000/api/auth/login";
  var self = this;
  var payload={
      "email":this.state.email,
      "password":this.state.password
  }
  axios.post(apiBaseUrl, payload)
  .then(function (response) {
      console.log(response);
      if(response.data.code == 200){
          console.log("Login successfull");
          var uploadScreen=[];
          uploadScreen.push(&lt;UploadScreen appContext={self.props.appContext}/&gt;)
          self.props.appContext.setState({loginPage:[],uploadScreen:uploadScreen})
      }
      else if(response.data.code == 204){
          console.log("Username password do not match");
          alert("username password do not match")
      }
      else{
          console.log("Username does not exists");
          alert("Username does not exist");
      }
  })
  .catch(function (error) {
  console.log(error);
  });
  }
  </code></pre>
  
  <p>I am not quite familiar with React and I just got this code <a href="https://medium.com/technoetics/create-basic-login-forms-using-create-react-app-module-in-reactjs-511b9790dede" rel="nofollow noreferrer">here</a>
  Just trying it out before I edit it. 
  I am trying to access my API which I created with Laravel 5.3 but I get the error: </p>
  
  <blockquote>
    <p>Failed to load <a href="http://127.0.0.1:8000/api/auth/login" rel="nofollow noreferrer">http://127.0.0.1:8000/api/auth/login</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:3000" rel="nofollow noreferrer">http://localhost:3000</a>' is therefore not allowed
    access.</p>
    
    <p>Error: Network Error
        at createError (createError.js:16)
        at XMLHttpRequest.handleError (xhr.js:87)</p>
  </blockquote>
  
  <p>I have searched for answers and they said that I should use CORS. I have Laravel CORS. </p>
  
  <p>my <code>cors.php</code> in config</p>
  
  <pre><code>'supportsCredentials' =&gt; false,
  'allowedOrigins' =&gt; ['*'],
  'allowedHeaders' =&gt; ['*'],
  'allowedMethods' =&gt; ['*'],
  'exposedHeaders' =&gt; [],
  'maxAge' =&gt; 0,
  'hosts' =&gt; [],
  </code></pre>