I'm trying to use Axios on my client to my server running on different port. I had to set credentials = 'include'; because I have my authentication token in my cookie. However, Axios doesn't seem to have that option.

I tried withcredentials = true, but what I need is credentials = 'include'. It didn't work indeed.

I have been using http module of Vue.js and the interceptor looks like,

Vue.http.interceptors.push((request, next) => {
request.credentials = 'include';
next()})

and this works fine. But I need to do exactly the same thing for Axios right now, and I have no idea how to.

I tried,

axios.interceptors.request.use(function(config){
config.credentials = true;
return config;}, function(error){})

but it didn't work.

Than you so much for any help!

0 Answers