You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WebAuthenticationBroker API that supports all WinAppSDK OS's and application types #441
UWP GapIssues where functionality available in UWP is missing for Win32 appsarea-WebViewTopics related to the WebView2 control in Windows App SDKfeature proposalmaui-7.xBugs targeted for maui-7.x
Proposal: Lifted WebAuthenticationBroker API that supports all Reunion OS's and application types
See #398, #366 - This issue is similar, but distinct in that it covers creating a new, lifted API, rather than updating the existing one to work for more application types.
Summary
Create an API that developers can use in any application type to implement OAuth2 functionality in any app supported by Reunion.
Rationale
The existing OS API that provides this functionality requires a core Window, which, for practical purposes, means that it only works for UWP-style application, and can't be used in other types of applications. Even if the OS API were updated, it would likely only be updated for new OS versions. It would be helpful for developers to have consistent support across OS versions.
And, of course, this should build on top of WebView2!
Note. The UWP one is based on IE and because of this will not work with many websites, forcing the developer to not be able to use WAB for Oauth with those sites.
Reacted by Rafael Rivera, Diego Pierangeli, Tung Huynh, edoust, Enis Necipoglu, Josef Fröhle, DL-YYA and Kateryna Novak
And, of course, this should build on top of WebView2!
I disagree. I'd rather we use the user's default browser to log in, then use protocol activation to come back to the application, as it follows better practices, and is impossible to spoof, and also has the benefit of supporting any saved credentials the user might have in their browser. I managed to actually make this work, but it was a lot of work, lots of code, manifest changes for protocol activation, dealing with app activation args, finding the right instance, shutting down the app if it was the wrong instance, redirecting to the correct instance, then dealing with resuming the authentication workflow there. It was quite non-trivial, and I really wish this could be wayyyyyyyyyyy easier.
I wish there was just a single call I could make that would do all this for me. Something like public static Task<Uri> OAuthSignIn(Uri authorizationUri, Uri callbackUri); and protocol activation, app instance tracking and resuming etc is just magically handled for me. I shouldn't have to configure my app at all, just configure my oauth with the right callback uri, and then pass it in here.
Another reason to not require webview2: There's no guarantee webview2 is actually available to the user.
Reacted by Wim Bokkers, Jon Wiswall, Michael Hawker, Dean Faizal, Richard Simpson, Howard Kapustein, Lars Pedersen, Matt Goldman, Ignotus, Matvei Stefarov and 12 more
app instance tracking and resuming etc is just magically handled for me. I shouldn't have to configure my app at all, just configure my oauth with the right callback uri, and then pass it in here
I agree with everything you've got here - it's important to use the same browser as the user is used to because it may have SSO cookies already set up making the auth basically no-op, or the user might have a password manager associated with it (Edge, LastPass, etc.) where they store their cookies.
Clever trick with the temporary http server. Very clever actually. There are some challenges though with available ports, and what ports you get to configure in the oauth redirect configuration
The discussion around embedded vs system browser is long and inconclusive. When it comes to Azure Active Directory, we've concluded that on desktop it's better to use a broker (WAM on Windows) because brokers increase security and SSO. Internally the broker uses an embedded browser.
Many apps use browsers today and generally the embedded browser are preferred because they provide a better user experience. System browsers are cross-plat but the experience is worse. I have not yet seen any conclusive evidence that system browser is better or worse than embedded browser in terms of security. In terms of SSO, embedded browsers fare poorer, because you are likely to have SSO cookies in your system browser already. But once you start using the embedded browser, it should store the cookies as well.
Hope this helps.
Reacted by Wim Bokkers, Den and John Gage Faulkner
changed the title [-]WebAuthenticationBroker API that supports all Reunion OS's and application types[/-][+]WebAuthenticationBroker API that supports all WinAppSDK OS's and application types[/+]on May 2, 2022
My opinion is that Xamarin and WinUI are dead. Don't use them. .NET is not dead only in Web (and maybe WPF, WinForms). I don't like it to happen either, since I developed for it 10 years+, but life is life. Jump off of the dead horse. 100% definition is that it is definitely not yet dead now. But it will.
PS: What I am trying to say is that they are alive (but there are signs that they are low priority projects like running iOS apps on intel desktop, maps and inkcontrols on WinUI, hanging for 5+ years bugs, retired VS mac), but looking at numbers of adoption % and market share (check google trends vs Flutter or React Native and WinUI against WPF, WinForms) and remembering Silverlight and Windows Phone story it is obvious what will happen next.
Reacted by Morten Nielsen, James Alickolli, Timo Partl, Samuel Sidor, Matt Goldman, Rahul, UhOhAdam, Armughan Ahmad, Mike Stancombe, Beto Rodríguez and 1 more
Thanks for the code. I will look at it. Does it work with .NET 10? Will it work in a few months with ,NET 11?
Should we really give up on Microsoft getting their act together and finally closing the WebAuthentication issue?
It's so frustrating that this critical MAUI (write once, run anywhere) library, works on all platforms except for Microsoft's own.
Is there anyone in the Microsoft managerial chain that can get the WinSdk and MAUI teams to get together and finally solve this?
Thanks for the code. I will look at it. Does it work with .NET 10? Will it work in a few months with ,NET 11? Should we really give up on Microsoft getting their act together and finally closing the WebAuthentication issue? It's so frustrating that this critical MAUI (write once, run anywhere) library, works on all platforms except for Microsoft's own. Is there anyone in the Microsoft managerial chain that can get the WinSdk and MAUI teams to get together and finally solve this?
solomonfried I have not tested on .net 10 but I imagine it should work but you may have to fiddle with the windows sdk version as mentioned on the WinUiEx site. As for the future, it would be fantastic if Microsoft delivered an official solution, but until then this is better than nothing I suppose.
I may have to bite the bullet and implement native WinUI authentication.
I’m a small business selling apps to schools. A few years ago, I always recommended Surface tablets. I developed on them myself, and my apps consistently ran best on Windows.
The version of my app currently in the Microsoft Store is still Xamarin-based. I already have a .NET MAUI version using WebView2, but I’ve held off releasing it because embedded browsers are increasingly discouraged for OAuth authentication. It still works today with providers like Google and Microsoft, but they explicitly reserve the right to stop supporting embedded browsers at any time.
Recently, I signed up a new school, and for the first time I recommended iPads instead.
The reason had nothing to do with hardware. I simply can’t guarantee that authentication on Windows will work as cleanly or reliably as it does on the other platforms. On iOS and Android, authentication is straightforward and well-supported. On Windows, I’m dealing with browser handoffs, platform-specific code, and uncertainty around future support.
That recommendation alone may represent anywhere from a few dozen to a few hundred devices this year. It won’t impact Microsoft’s numbers in any meaningful way, but it makes me wonder how many larger vendors are making the same calculation.
Authentication is the front door to every serious app. It’s astonishing that Microsoft has allowed this situation to persist for so long.
Reacted by Vladimir Davidovich, Samuel Sidor, kirquebe and Hans Bakker
UWP GapIssues where functionality available in UWP is missing for Win32 appsarea-WebViewTopics related to the WebView2 control in Windows App SDKfeature proposalmaui-7.xBugs targeted for maui-7.x
Activity
mrlacey commentedon Feb 25, 2021
And, of course, this should build on top of WebView2!
Note. The UWP one is based on IE and because of this will not work with many websites, forcing the developer to not be able to use WAB for Oauth with those sites.
michael-hawker commentedon Mar 1, 2021
This was originally a request on the WebView2 team here: MicrosoftEdge/WebView2Feedback#171
There's probably some interop involved I believe between Edge, the OS, and WebView2?
dotMorten commentedon Apr 4, 2022
I disagree. I'd rather we use the user's default browser to log in, then use protocol activation to come back to the application, as it follows better practices, and is impossible to spoof, and also has the benefit of supporting any saved credentials the user might have in their browser. I managed to actually make this work, but it was a lot of work, lots of code, manifest changes for protocol activation, dealing with app activation args, finding the right instance, shutting down the app if it was the wrong instance, redirecting to the correct instance, then dealing with resuming the authentication workflow there. It was quite non-trivial, and I really wish this could be wayyyyyyyyyyy easier.
I wish there was just a single call I could make that would do all this for me. Something like
public static Task<Uri> OAuthSignIn(Uri authorizationUri, Uri callbackUri);and protocol activation, app instance tracking and resuming etc is just magically handled for me. I shouldn't have to configure my app at all, just configure my oauth with the right callback uri, and then pass it in here.Another reason to not require webview2: There's no guarantee webview2 is actually available to the user.
jonwis commentedon Apr 4, 2022
I agree with everything you've got here - it's important to use the same browser as the user is used to because it may have SSO cookies already set up making the auth basically no-op, or the user might have a password manager associated with it (Edge, LastPass, etc.) where they store their cookies.
For reference, there is https://github.com/Microsoft/cpprestsdk/blob/master/Release/src/http/oauth/oauth2.cpp (and its friend https://github.com/Microsoft/cpprestsdk/blob/master/Release/include/cpprest/oauth2.h), which we'd have to review to see if it behaves correctly. VSCode already does this as well, setting itself up a temporary HTTP server to support the redirect, etc.
dotMorten commentedon Apr 4, 2022
Clever trick with the temporary http server. Very clever actually. There are some challenges though with available ports, and what ports you get to configure in the oauth redirect configuration
bgavrilMS commentedon Apr 5, 2022
If you need a reference implementation, please feel free to use MSAL's, it is MIT licensed.
WebView2
WebView1
System Browser using http listner
The discussion around embedded vs system browser is long and inconclusive. When it comes to Azure Active Directory, we've concluded that on desktop it's better to use a broker (WAM on Windows) because brokers increase security and SSO. Internally the broker uses an embedded browser.
Many apps use browsers today and generally the embedded browser are preferred because they provide a better user experience. System browsers are cross-plat but the experience is worse. I have not yet seen any conclusive evidence that system browser is better or worse than embedded browser in terms of security. In terms of SSO, embedded browsers fare poorer, because you are likely to have SSO cookies in your system browser already. But once you start using the embedded browser, it should store the cookies as well.
Hope this helps.
[-]WebAuthenticationBroker API that supports all Reunion OS's and application types[/-][+]WebAuthenticationBroker API that supports all WinAppSDK OS's and application types[/+]dotMorten commentedon May 3, 2022
Until the WinAppSDK adds this, I've added this ability to WinUIEx v1.4. It's nothing more than a simple one-line call. See https://dotmorten.github.io/WinUIEx/concepts/WebAuthenticator.html
100 remaining items
snow-jallen commentedon Oct 2, 2025
Could someone point to a tutorial on how one might "do oauth in a Maui on windows using these APIs"?
SongPing commentedon Oct 23, 2025
This issue is more than 4 years old.
Is there no solution yet?
This is very disapointing.
solomonfried commentedon Dec 4, 2025
Now December 2025 and still no support.
I am spending hours trying to get an alternative using WinUIEx or anything else.
I would love to just drop Windows support for my app, but it is used in schools and many have Surface tablets.
If ANYONE has resolved this, please post.
Mogikan commentedon Dec 5, 2025
My opinion is that Xamarin and WinUI are dead. Don't use them. .NET is not dead only in Web (and maybe WPF, WinForms). I don't like it to happen either, since I developed for it 10 years+, but life is life. Jump off of the dead horse. 100% definition is that it is definitely not yet dead now. But it will.
PS: What I am trying to say is that they are alive (but there are signs that they are low priority projects like running iOS apps on intel desktop, maps and inkcontrols on WinUI, hanging for 5+ years bugs, retired VS mac), but looking at numbers of adoption % and market share (check google trends vs Flutter or React Native and WinUI against WPF, WinForms) and remembering Silverlight and Windows Phone story it is obvious what will happen next.
philnwoha commentedon May 5, 2026
I made a post here on how I was able to get this working for my .net maui windows app.
solomonfried commentedon May 6, 2026
Thanks for the code. I will look at it. Does it work with .NET 10? Will it work in a few months with ,NET 11?
Should we really give up on Microsoft getting their act together and finally closing the WebAuthentication issue?
It's so frustrating that this critical MAUI (write once, run anywhere) library, works on all platforms except for Microsoft's own.
Is there anyone in the Microsoft managerial chain that can get the WinSdk and MAUI teams to get together and finally solve this?
philnwoha commentedon May 6, 2026
solomonfried I have not tested on .net 10 but I imagine it should work but you may have to fiddle with the windows sdk version as mentioned on the WinUiEx site. As for the future, it would be fantastic if Microsoft delivered an official solution, but until then this is better than nothing I suppose.
dotMorten commentedon May 6, 2026
Yes.
solomonfried commentedon May 7, 2026
I may have to bite the bullet and implement native WinUI authentication.
I’m a small business selling apps to schools. A few years ago, I always recommended Surface tablets. I developed on them myself, and my apps consistently ran best on Windows.
The version of my app currently in the Microsoft Store is still Xamarin-based. I already have a .NET MAUI version using WebView2, but I’ve held off releasing it because embedded browsers are increasingly discouraged for OAuth authentication. It still works today with providers like Google and Microsoft, but they explicitly reserve the right to stop supporting embedded browsers at any time.
Recently, I signed up a new school, and for the first time I recommended iPads instead.
The reason had nothing to do with hardware. I simply can’t guarantee that authentication on Windows will work as cleanly or reliably as it does on the other platforms. On iOS and Android, authentication is straightforward and well-supported. On Windows, I’m dealing with browser handoffs, platform-specific code, and uncertainty around future support.
That recommendation alone may represent anywhere from a few dozen to a few hundred devices this year. It won’t impact Microsoft’s numbers in any meaningful way, but it makes me wonder how many larger vendors are making the same calculation.
Authentication is the front door to every serious app. It’s astonishing that Microsoft has allowed this situation to persist for so long.