i'm trying to receive cookies from my node js API , i have seen some articles that says you need to have the same port of your frontend as your backend so you can receive the cookies , and i have seen others say that you need to make the withCredentials
value to true when fetching from the api but when i set it to true i get this 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'.
Can someone explain what is this error and how to resolve it ?
or is there any other way to receive cookies easily ?
CodePudding user response:
In your cors middleware set the origin to true and credentials to true.
const cors = require("cors");
app.use(cors({origin : true , credentials :true}))