When I use:
async function APIsignUp(name, pass) {
let response = await fetch(domain + `signup`, {
method: "GET",
credentials: "include",
});
return await response.json();
}
It works well but after adding some custom headers:
async function APIsignUp(name, pass) {
let response = await fetch(domain + `signup`, {
method: "GET",
credentials: "include",
headers: {
"X-Username": name,
"X-Password": pass,
},
});
return await response.json();
}
It will throw error:
The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
But I already added Access-Control-Allow-Origin, Access-Control-Allow-Credentials and Access-Control-Allow-Headers header at server-side (I use sqark java)
At my server-side:
res.header("Access-Control-Allow-Origin", domain);
res.header("Access-Control-Allow-Credentials", "true");
res.header("Access-Control-Allow-Headers", "X-Username, X-Password");