I am getting an error that is preventing me from getting a cookie for auth with Directus.
Access to fetch at 'https://mydomain.com/auth/login' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field credentials is not allowed by Access-Control-Allow-Headers in preflight response.
I have the following for my fetch:
const handleSubmit = async () => {
const url = 'https://mydirectusdomain.com/auth/login'
const request = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
credentials: 'include',
},
body: JSON.stringify({
email: email,
password: password,
mode: 'cookie',
}),
})
const response = await request.json()
console.log(response)
}
I have the following .env vars in Directus
CORS_CREDENTIALS=true
CORS_ENABLED=true
CORS_ORIGIN=true