Netlify deployed React app not sending Cookie data to Backend

The netfify deployment domain I’m using is https://gemuese-marktplatz.netlify.app/
I’m using the latest version of Chrome to access it.

Just today, I pushed a new build to my Netlify site. This one has authorization, and the way I do it is that the backend sends a cookie (with a token) to the frontend (netlify app), which then receives and sets that cookie and sends the required credentials as ‘included’ on many different fetch calls. Noteworthy to say might be that this is a HttpOnly cookie (token).

Here’s an example fetch call:

doFetch({
url: ${config.url}/unclicked_sales_count,
requestObject: { credentials: ‘include’ },
dataFn: setSalesUnclickedCount
})

I noticed that the backend does send the cookie, and that the Cookie is set properly in the application storage window in the browser inspector, but the cookie seems to not get sent back to the backend from the netlify application (it’s not listed in the Request Headers).
Using the same build, testing this locally still works, so it must be something that is being blocked on Netlify’s site. Is there a proper way to send credentials from a Netlify deployed app?

Nevermind. The cookie that appeared in the browser inspector was from a previous session, clearing it made me realize the cookie was never set on the frontend.

Changing the cookie sameSite and secure attribute fixed it.

1 Like

Hey there @Bioflakes :wave:

Welcome to the Netlify Forums! Thanks so much for sharing the solution to your obstacle. This is super helpful for future Forums members who may encounter something similar. :netliconfetti: