How to set allowSingleSignOnUsingOSPrimaryAccount property for Webview in MAUI ?

Sanket Vinod Solanki 30 Reputation points
2023-05-08T06:00:03.5366667+00:00

Hi.

We have developed MAUI application and we are displaying our website in WebView control of MAUI.

Our website requires 2FA but after entering our credentials the page does not load since Device ID is not passed with the Webview.

After going through this article https://github.com/MicrosoftEdge/WebView2Feedback/issues/550 we found that we have to enable allowSingleSignOnUsingOSPrimaryAccount to true in WebView environment.

Please let us know how can we achieve the same, so that Device ID gets passed with WebView.

Note - We are not able to find this property in MAUI WebView but we are able to find the property in WPF WebView2 control.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,150 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,431 Reputation points Microsoft External Staff
    2023-05-09T08:19:17.7666667+00:00

    Hello,

    We are not able to find this property in MAUI WebView but we are able to find the property in WPF WebView2 control.

    This a known issue reported at WindowsAppSDK's GitHub Repo- WebView2 does not support passing in a CoreWebView2Environment #1170. Please follow the progress at GitHub.

    Maui App that targets Windows platform is based on WinUI 3. Since WebView2 class with WinUI3 doesn't support this property, you cannot use it with MAUI for now.

    (There is a same thread posted at SO)

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.