title: Problem sending/storing session cookie with Vue Axios (CORS)
body: <p>I cant for some reason store the session cookie from my Flask-backend (port 5000) and send it as credentials from my Vue-frontend (port 8082) via Axios. I create a global axios on the frontend, then login to get the session cookie, and then try to do a request requiring authentication. I see that the cookie gets with response from /login but when next request gets made it doesnt contain it, resulting in 401. The requests work fine with Postman so I assume the problem lies with CORS somehow preventing credentials from being sent.</p>
  <p>main.js (setting global instance of Axios)</p>
  <pre><code>Vue.prototype.$http = Axios;
  Vue.prototype.$http.defaults.withCredentials = true
  </code></pre>
  <p>auth.js (Vuex module for logging in, and getting cookie)</p>
  <pre><code>this._vm.$http.post(backendUrl+'/api/login', {
    email: formEmail,
    password: formPassword,
     headers: {'Content-type': 'application/json'}
  })
  .then(function (response) {
    console.log(response.data);
    router.push('profile');
    commit(types.UPDATE_AUTH_SIGN_USER_SUCCESS, response)
    commit(types.UPDATE_AUTH_FORM_PASSWORD, '')
    commit(types.UPDATE_AUTH_FORM_EMAIL, '')
    commit(types.RESET_APP_LOADING)
  })
  </code></pre>
  <p>Profile.Vue (request requiring session cookie auth which doesnt work, 401)</p>
  <pre><code>  this.$http.get(backendUrl+'/api/user/gdpr/fetch', function (response) {
      console.log(response);
      if (response.data == 0) {
        context.dialogGDPR = true;
      }
      context.$store.commit(types.UPDATE_APP_IS_LOADING, false)
    })
  </code></pre>
  <p>For the Flask-backend i activate CORS using the following:</p>
  <p>app.py</p>
  <pre><code>CORS(app, origins='http://127.0.0.1:8082', supports_credentials=True)
  app.config['CORS_HEADERS'] = 'Content-Type'
  </code></pre>
  <p>and this for each defined request:</p>
  <pre><code>@cross_origin(origins='http://127.0.0.1:8082', supports_credentials=True)
  </code></pre>