0

I have to embed a page with iframe to a different domain page. enter image description here

This iframe is loaded with a jwt token that authenticates the user in domain B.

This response, creates a session cookie and reloads the page (from domain B to domain B page) of the iframe.

This process works for Firefox, but doesn't work for Chrome because the setcookie is refused due to SameSite settings.

Probably I did not understand the SameSite settings because the authentication happened starting from domain B to domain B so I cannot understand why SameSite Lax is not valid for Chrome.

Heiko Theißen
18.3k2 gold badges14 silver badges50 bronze badges
asked Oct 11, 2024 at 15:50
2
  • Are both A and B running https? Commented Oct 11, 2024 at 16:07
  • Yes they are https Commented Oct 12, 2024 at 19:35

1 Answer 1

2

Browsers employ two mechanisms to deny a page from domain B access to its cookies when it is embedded (iframed) within a page from domain A, if A and B are from different sites, for example, A = example.com and B = myapp.org.

The first mechanism has been in force for a few years: To be accessible, the cookie must have SameSite=None. The SameSite cookie attribute is not only evaluated during page embeddings, but also during navigation from a page from A to a page from B. For navigation, SameSite=Lax would be sufficient, but what blocks you is the embedding, not the navigation.

The second mechanism is much more far-reaching, since it does not depend on an attribute like SameSite (which the server controls), but is controlled by the browser alone: third-party cookie blocking. This is currently being rolled out by Chrome (and other browser vendors, though perhaps not yet Firefox) under the "privacy protection" headline.

Privacy-preserving alternatives to third-party cookies are partitioned cookies (which are valid in one embedding, but not across embeddings) and the storage access API (whereby the user is prompted to grant access to the third-party cookies).

answered Oct 11, 2024 at 16:09
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.