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

WinUI support for CoreWebView2EnvironmentOptions: UWP unable to enable webview2 support for SSO #747

Closed
JRawlins737 opened this issue Dec 17, 2020 · 5 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@JRawlins737
Copy link

JRawlins737 commented Dec 17, 2020

I am trying to put together a test UWP app to validate webview2 integration with SSO (AzureAD) does in fact handle Conditional access checks. The code below is taken from that UWP app where the EnsureCoreWebView2Async method does not allow any parameters (the environment parameter is needed)... Built a WPF version and the parameter works fine... unfortunately, I need this to work in UWP.

CoreWebView2EnvironmentOptions options = new CoreWebView2EnvironmentOptions()
{
    AllowSingleSignOnUsingOSPrimaryAccount = true
};

CoreWebView2Environment environment = await CoreWebView2Environment.CreateWithOptionsAsync("", "", options);
            
await webview.EnsureCoreWebView2Async(environment); //<-- Method does not support the parameter to set the environment

webview.Source = new Uri("https://www.yammer.com");

Visual Studio: 16.9.0 Preview 2.0
WinUI3 Version: 3.0.0-preview3.201113.0
Runtime: Version 89.0.731.0 (Official build) dev (64-bit)
Framework: UWP
OS: Version 10.0.19041.685

Repro Steps

  1. Create a UWP App Add a Webview2 to the mainpage xaml, name it "webview"
  2. Paste this into the mainpage.xaml.cs:
public MainPage()
        {
            this.InitializeComponent();

            this.Loaded += MainPage_Loaded;
        }

        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            CoreWebView2EnvironmentOptions options = new CoreWebView2EnvironmentOptions()
            {
                AllowSingleSignOnUsingOSPrimaryAccount = true
            };

            CoreWebView2Environment environment = await CoreWebView2Environment.CreateWithOptionsAsync("", "", options);
            
            await webview.EnsureCoreWebView2Async(environment);

            webview.Source = new Uri("https://www.yammer.com");

        }

You'll notice Ensure.... is not happy.. Works fine with WPF.

Screenshots

Additional context

AB#33760896

@JRawlins737 JRawlins737 added the bug Something isn't working label Dec 17, 2020
@jasonstephen15 jasonstephen15 self-assigned this Dec 22, 2020
@pranavchaturvedi-007
Copy link

We are facing the same issue in our UWP Application, please provide a fix for this ASAP !!

@wbokkers
Copy link

Please fix this for WinUI 3 as well.

@sparkrod
Copy link

sparkrod commented Apr 6, 2023

Any update on this? I am attempting to work around this in UWP using the browser arguments:

Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=msSingleSignOnOSForPrimaryAccountIsShared");

Is this the correct approach? Should I also enable the UWP app capability enterpriseCloudSSO for Azure AD account use?

@champnic champnic changed the title UWP unable to enable webview2 support for SSO WinUI support for CoreWebView2EnvironmentOptions: UWP unable to enable webview2 support for SSO Jun 1, 2023
@champnic
Copy link
Member

champnic commented Jun 1, 2023

@sparkrod Yes that's the correct workaround for this. We already have this work tracked internally and on the WinUI team. Related to #2933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

7 participants