NodeJS express response cookie does not set cookie in client.

In your NodeJS, you declare to respond with a cookie in its header:

response.cookie("accessToken", accessToken, {
expires: new Date( + 60_000), // 60 seconds

But the client does not save cookies from its reponse header because you must specify withCredential in your axio configuration:

const instance = axios.create({
baseURL: '',
withCredential: true



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.