Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookies read/write not working in WebView on WinUI #3901

Closed
chrfin opened this issue Jan 3, 2022 · 11 comments · Fixed by #13518
Closed

Cookies read/write not working in WebView on WinUI #3901

chrfin opened this issue Jan 3, 2022 · 11 comments · Fixed by #13518
Assignees
Labels
area-controls-webview WebView fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@chrfin
Copy link

chrfin commented Jan 3, 2022

Description

Reading or writing Cookies (see docs) are not working on WinUI.
I think this is because the WebViewRenderer uses the "old" HttpBaseProtocolFilter approach to read/write cookies to the underlying WebView2 control, which does not work.
The new approach should be used: https://github.com/MicrosoftEdge/WebView2Feedback/blob/master/specs/CookieManagement.md

Steps to Reproduce

See https://github.com/dotnet/maui/blob/main/src/Compatibility/Core/src/Windows/WebViewRenderer.cs#L255

Version with bug

Preview 11

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

10.0.19041

Did you find any workaround?

I'm using a custom HybridWebView where I (partially) implemented the new solution.
See devsmadeofsteel/Plugin.HybridWebView#17

Relevant log output

No response

@chrfin chrfin added the t/bug Something isn't working label Jan 3, 2022
@chrfin
Copy link
Author

chrfin commented Jan 3, 2022

I may try to update the MAUI WebViewRenderer myself and create a pull request if I find some time later this week.

@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jan 18, 2022
@wenwen60
Copy link

Thank you so much for your bug report! Unfortunately, we cannot reproduce your issue with the information above, could you provide a sample project/screenshots or more details that we can reproduce your issue? That should greatly speed up the process, thanks!

@wenwen60 wenwen60 added the s/needs-repro Attach a solution or code which reproduces the issue label Mar 11, 2022
@ghost
Copy link

ghost commented Mar 11, 2022

Hi @chrfin. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@chrfin
Copy link
Author

chrfin commented Mar 11, 2022

@wenwen60 The renderer for MAUI still uses HttpBaseProtocolFilter (see link above), but for WebView2 the new CookieManager  should be used (see other link above).

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Mar 11, 2022
@Redth Redth added this to the 6.0.300 milestone Mar 23, 2022
@VincentBu
Copy link

Here is a sample project: MauiApp3901.zip

feel free to point out if the following repro steps doesn't make sense:

  1. run the project
  2. press F12 to open DevTools
  3. click button "WriteCookie"
  4. check cookie in DevTools and there is no cookie we write
    image

@VincentBu VincentBu added the s/verified Verified / Reproducible Issue ready for Engineering Triage label May 11, 2022
@samhouts samhouts modified the milestones: 6.0.300, 6.0.300-servicing May 12, 2022
@alexeystrakh
Copy link

I'm having the same issue with cookies are not being set on MAUI WebView control. I have created a sample to reproduce the issue: https://github.com/xamcat/maui-webview-cookieissue

Maui WebView:
image
image

WinUI3 WebView2
image

The sample contains two projects:

  1. Maui WebView - cookie is set and NOT visible to JS code
  2. WinUI3 WebView2 - cookie is set and visible to the JS code

@jfversluis
Copy link
Member

I see that we merged a PR that uses the CookieManager: https://github.com/dotnet/maui/blob/main/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs#L169

Could someone confirm that this is still an issue with the latest release (6.0.400, released yesterday at the time of writing)

@jfversluis jfversluis added s/needs-info Issue needs more info from the author and removed s/needs-attention Issue has more information and needs another look labels Jun 15, 2022
@ghost
Copy link

ghost commented Jun 15, 2022

Hi @chrfin. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Banurega
Copy link

Banurega commented Jun 16, 2022

I see that we merged a PR that uses the CookieManager: https://github.com/dotnet/maui/blob/main/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs#L169

Could someone confirm that this is still an issue with the latest release (6.0.400, released yesterday at the time of writing)

Hi, I'm still having the same issue with cookies are not set on MAUI WebView after release.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Jun 16, 2022
@degenet
Copy link

degenet commented Jun 27, 2022

I see that we merged a PR that uses the CookieManager: https://github.com/dotnet/maui/blob/main/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs#L169

Could someone confirm that this is still an issue with the latest release (6.0.400, released yesterday at the time of writing)

I can confirm this issue is still present.

@jfversluis jfversluis removed the s/needs-attention Issue has more information and needs another look label Jun 29, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@jsuarezruiz jsuarezruiz removed their assignment Feb 13, 2023
@jfversluis jfversluis self-assigned this Feb 23, 2023
@samhouts samhouts modified the milestones: Backlog, .NET 8 Planning Mar 17, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Apr 12, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 12, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-webview WebView fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.