Got this error:
The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'.
Here when pressing Login button in top right. https://sp-poc.com/admin
This code is called:
axios
.post(
`loginEmail`,
{
headers: {
crossDomain: true,
},
},
{ withCredentials: true }
)
backend is on a different domain, but I did set DNS record: A and CNAME record for it as it is suggested here: https://vercel.com/support/articles/pointing-subdomains-to-external-services
I event tried to set Access-Control-Allow-Credentials manually in response.
func loginEmail(_ req: Request) throws -> Response
{
let response = Response(status: .ok)
let cookie = HTTPCookies.Value(string: "abcdef", isHTTPOnly: true)
response.cookies["userId"] = cookie
response.headers = HTTPHeaders([("Access-Control-Allow-Credentials", "true")])
return response
}
What is wrong here?
- I though if I do the A, CNAME record trick, it will not seem as a cross-site request.
- If it seem a cross site request why returning
truedoes not help?
