title: Laravel + vueJs + axios, bearer token not working
body: <p>I'm trying to learn how to build a basic API for a vue.js app using Axios and Laravel cors installed.</p>
  
  <p>I can get the api to to do most calls like, logging in, registering, access unsecured areas but when I try to access a protected area it's coming back with this error in my browser console</p>
  
  <blockquote>
    <p>Failed to load <a href="http://127.0.0.1:8000/api/closed" rel="nofollow noreferrer">http://127.0.0.1:8000/api/closed</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:8080" rel="nofollow noreferrer">http://localhost:8080</a>' is therefore not allowed
    access.</p>
  </blockquote>
  
  <p>Here is my Vue JS funciton</p>
  
  <pre><code>userArea () {
  
    const HTTP = axios.create({
      baseURL: `http://127.0.0.1:8000/api/`,
      headers: {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Credentials": true,
        Authorization: 'Bearer ' + this.token
      }
    })
  
      HTTP.get('closed')
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
  }
  </code></pre>
  
  <p>laravel cors.php</p>
  
  <pre><code>namespace App\Http\Middleware;
  
  use Closure;
  
  class Cors
  {
      /**
       * Handle an incoming request.
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  \Closure  $next
       * @return mixed
       */
      public function handle($request, Closure $next)
      {
          return $next($request)
          -&gt;header('Access-Control-Allow-Origin', '*')
          -&gt;header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE, OPTIONS')
          -&gt;header('Access-Control-Allow-Headers', 'Origin, Content-Type, X-Auth-Token, Authorization, X-Requested-With');
  
      }
  }
  </code></pre>
  
  <p>Edit:
  Using postman to emulate the request works fine
  <a href="https://i.stack.imgur.com/8N9IE.png" rel="nofollow noreferrer">postman example</a></p>