title: How pass a Bearer token in Axios
body: <p>I look for an answer this morning and try lot of things but my axios API Call always failed with a 401 error.</p>
  
  <p>Furthemore if I try a curl from the console or postman the request works and I don't understand why on my front with vue and axios it's failed.</p>
  
  <p>I tried to pass the bearer globally, then for a unique route</p>
  
  <p>First of all I have the configuration of my module for Axios</p>
  
  <pre><code>export default() =&gt; {
    return axios.create({
      baseURL: process.env.VUE_APP_API,
      headers: { 
          'Content-Type': 'application/json',
          Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyIn0.wxYD9dllTqT1gAIBmwo35Z4Q4qmlDZwXqz9FdYqXZnU'
      }
    })
  }
  </code></pre>
  
  <p>Then I have my request </p>
  
  <pre><code>Api().get(`user-profiles/${id}`).then(function (response) {
          return(response)
        })
  </code></pre>
  
  <p>The request is this one:</p>
  
  <pre><code>Request URL: https://***
  Request Method: OPTIONS
  Status Code: 401 
  Remote Address: ****
  Referrer Policy: no-referrer-when-downgrade
  Access-Control-Allow-Headers: Content-Type
  Access-Control-Allow-Methods: GET, POST, DELETE, PUT, PATCH
  Access-Control-Allow-Origin: *
  Access-Control-Expose-Headers: Location
  Provisional headers are shown
  Access-Control-Request-Headers: authorization
  Access-Control-Request-Method: GET
  Origin: http://localhost:8080
  Referer: http://localhost:8080/login
  User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Mobile Safari/537.36
  </code></pre>
  
  <p>Do you need other data ? 
  The request works if I don't use a Bearer token...</p>
  
  <p>I need to pass a Bearer token because for production release I can't take off the bearer.</p>
  
  <p>Thank you in advance for your help.</p>