4 years ago

CORS and VueJS.

Posted 4 years ago by socieboy

Hi, I'm using VueJS to do a get request to another domain but I'm getting the error of CORS.

XMLHttpRequest cannot load Response to preflight request doesn't pass access control check: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin '' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.

I set some parameters on the Vue global headers but I can't make it works yet. Some help please.

Vue.http.options.xhr = {withCredentials: true};
Vue.http.headers.common['Authorization'] = 'Basic ' + btoa("username:password");

Please sign in or create an account to participate in this conversation.