jeudi 23 juillet 2020

Subdomin returning set cookie header but browser not accepting the cookie

I have my local development setup running on https via self signed SSL certificate using create react app running https://localhost:3000.

I am pretty new to backend development/api development

The app on start first calls a GET rest api hosted on https://mysubdomain.mydomain.com/somePath which returns a set-cookie header with value as follows

demoCookie=demoValue; path=/; Max-Age=2592000; SameSite=None; Secure;

I am expecting this cookie to be paseed on all subsequent api calls and requests made to https://mysubdomain.mydomain.com/* automatically by browser.

But this cookie does not show in chrome dev tool application tab neither in the request headers.

but on contrary if I open dev tool console on https://mysubdomain.mydomain.com/somePath and run following code

document.cookie=`demoCookie=demoValue; path=/; Max-Age=${30 * 24 * 60 * 60}; SameSite=None; Secure;`

It all works as I am expecting the cookie gets passed automatically.

what am I missing in set-cookie header? Am I expecting correct behaviour?




Aucun commentaire:

Enregistrer un commentaire