Express sameSite cookies not accessable to react dev server

  • I am using jwt to authorize users on a react app I am working on. As opposed to using localStorage or sessionStorage to store these tokens, I am sending httpOnly, sameSite: strict, secure cookies as shown.

    My app is successfully able to communicate with my api using the access and refresh tokens while hosted on the same domain as the api server (http://www.example.com/app, http://www.example.com/api).

    If I understand correctly the react development server is hosted on an http server running on port 3000. Because this server is considered to be running on a different and unsecure domain, these secure cookies are not able to be properly communicated. I thought reconfiguring these cookies to secure: false and sameSite: "none" would have allowed these cookies to be correctly communicated but it hasn't.

    Why is it that these updated cookies are unable to be sent/received with the development server and what can I do to properly configure them?

    If its any use, here is the request header from each server:

    Production server correctly receives cookies

    Development server

  • burger November 28, 2022 at 2:44 AM

    Changed the title of the thread from “Express sameSite cookies accessable to react dev server” to “Express sameSite cookies not accessable to react dev server”.