Skip to content

Instantly share code, notes, and snippets.

@LasseRafn
Created December 7, 2016 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LasseRafn/d2c1cfd091137444507f7d932a960efc to your computer and use it in GitHub Desktop.
Save LasseRafn/d2c1cfd091137444507f7d932a960efc to your computer and use it in GitHub Desktop.
Vue.http.headers.common['X-CSRF-TOKEN'] = Laravel.csrfToken;
Vue.http.interceptors.push((request, next) => {
request.headers.set('X-CSRF-TOKEN', Laravel.csrfToken);
next();
});
// I tried both of these approaches (even at the same time??)
// It even sends the token with the request, yet it still fails
// (SOMETIMES).. Just at random. Can be working today, and tomorrow
// it will fail. My boss probably hates me.
// CSRF = Disabled. Never coming back again. Already lost too many
// clients/customers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment