msonowal / vue-echo

MIT License
20 stars 9 forks source link

withCredential #3

Closed dhcmega closed 3 years ago

dhcmega commented 3 years ago

Hi! thanks for this package, I will start using it in my vue spa. The only thing that is not working is the authEndpoint, because I cannot set cookies, so there is no session. Is there a solution to this? Thanks!

dhcmega

dhcmega commented 3 years ago

Solved by adding this before use Vue.use:

Pusher.Runtime.createXHR = function () { var xhr = new XMLHttpRequest() xhr.withCredentials = true return xhr }

and headers:

withCredentials: true, auth: { headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest', 'X-CSRF-Token': xsrfToken, }, },