Why am I not seeing an HTTPOnly cookie in the Browser (Cookies) which I should have received from the server? I tried the request in Postman but the HttpOnly cookie is present.
Server is deploed in https://example.vercel.app
Frontend is running in localhost:3000
Backend Middlewares
app.use(cors({ origin: true, credentials: true}));
app.use(cookieParser());
app.use(express.json());
Backend Function
const cookieOptions = { httpOnly: true, maxAge: MAX_AGE }
return res.status(200)
.cookie('token', token, cookieOptions)
.json({});
This is working properly in Postman, however doing this on localhost react-app isn't working. here's the example of my Axios instance
Frontend ReactJS Axios instance
const instance = axios.create({
baseURL: process.env.REACT_APP_BASE_URL,
timeout: 9000,
withCredentials: true,
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
}
});
I literally have no idea what's happening, this is my first time using HttpOnly.