Using cookie while on local

Hello,

I would like to use cookie on local to test. When I run the app with the command fdk run, the document.cookie always throws an empty string. If I run it on a server like http://127.0.0.1:5500/, it works. However, I want to use the cookie when running fdk run. Is there any way to do that?

Thank you very much.
Nhat Nguyen

Hi @Nhat_Nguyen,
Good Day!
since our app is rendering in Iframe you can’t set the cookie directly, as per the latest security fix from the browser (always block third party cookie) and you need to set explicitly SameSite=none
kindly refer to this for link for more detail.
Hope it helps :slight_smile:

Thanks

Hello,
Thanks for your quick answer. As I have researched, I have to set Cookie SameSite on the server-side because it is HttpOnly Tag. Therefore, I want to setCookie on serverless app, however, I don’t know how to do it. How to set Cookie HttpIOnly Tag in serverless app?

Thank you.
Nhat Nguyen

@Nhat_Nguyen,
You mean you are setting a cookie from our serverless app (server.js) and are you using any HTTP server to request and getting a response if so please refer to this link for more reference.

if this solution is not working, can you please explain in more detail what you are trying to solve?

Thanks