Skip to content

Conversation

@augyg
Copy link

@augyg augyg commented Mar 17, 2025

Summary Line: allow third party cookies through .setAcceptThirdPartyCookies

Motivation:

CORS is required for an app entirely run inside of a webview for a connection to the server unless we use websockets. There are many cases such as large files and streaming where it would be undesirable to do through websockets.

It is also impossible to return the cookie in a request then set it through JS if the Cookie appears to be for a different domain. Currently any android app will have the appassets route as it's origin, since this is where index.html is loaded from, therefore any obelisk backend will be viewed as a different server. Even if that was not the case, there might still be cases where we would like to have an authenticated connection with a true third party

@alexfmpe
Copy link
Member

alexfmpe commented Mar 19, 2025

Sounds reasonable, though I'm not yet sure whether it's safe to impose as default on everyone. On that note, it doesn't feel right to me that the way to tweak any setting in the .java requires forking reflex-dom or android-activity, but I don't know these parts enough to have an opinion on alternatives.

I'll be able to take a better look in a couple weeks.

@augyg
Copy link
Author

augyg commented Mar 19, 2025

Fair point, I can see how allowing for general use of third party cookies can be unsafe however it's interesting that you mention this constraint of needing to tweak MainWidget.java because the first idea I had in mind was for shouldInterceptRequest to check if it's to a the route specified in config/common/route (assuming it's an obelisk project) and then handle this request in Java, returning a WebviewResponse.

I do still think there are niche cases where an app would want a true third party request but perhaps there is an ideal solution to control this through a list of allowed hosts / urls

@augyg
Copy link
Author

augyg commented Apr 2, 2025

obsidiansystems/obelisk#348 (comment)

I came across this just now and I wanted to put this link as a placeholder to investigate why they were allegedly able to make a request to the backend no problem. Perhaps something has changed like with using the android app assets url https://appassets.androidplatform.net via #452

ali-abrar
ali-abrar previously approved these changes Oct 22, 2025
@ali-abrar ali-abrar self-requested a review October 22, 2025 15:41
@ali-abrar ali-abrar dismissed their stale review October 22, 2025 15:42

accidental click

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants