How to set server-side cookie to iframe on iphone or ipad?

I developed web game. But while integrating this game inside iframe in other websites, setting server-side cookie not working on only iphone or ipad devices.
When it launch game url, the sever set cookies using response header. But it is not working.

    res.cookie("token", token, {
      path: "/",
      httpOnly: true,
      overwrite: true,
      sameSite: "None",
      secure: true,
    });
    res.cookie("lang", user.lang, {
      overwrite: true,
      sameSite: "None",
      secure: true,
    });
    res.cookie("locale", locale[user.lang], {
      overwrite: true,
      sameSite: "None",
      secure: true,
    });

All the browsers are working on all devices except iphone or iframe.
Even if the device is iphone or ipad, they are working when I do not use iframe.
How to fix it?

I’d help if I could, but I have no idea.
The thing is, this is a support forum for the Garuda Linux distribution, not Stack Overflow…
If the iframe problem was happening in Firedragon it could be “our problem” but… iPhone and iPad?
They use Safari if I’m not mistaken, maybe that explains the different behavior.
I think you may have better luck asking on the appropriate Stack Exchange section, or some forum dedicated to programing on Apple devices, or web development in general. Maybe these days some AI can help too.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.