|
1 | 1 | ---
|
2 | 2 | title: Implement OAuth 2.0 functionality in Windows apps
|
3 | 3 | description: Learn how to implement OAuth 2.0 functionality in Windows apps using the Windows App SDK's OAuth2Manager.
|
4 |
| -ms.date: 01/05/2025 |
| 4 | +ms.date: 03/19/2025 |
5 | 5 | ms.topic: concept-article
|
6 | 6 | keywords: windows, winui, winrt, dotnet, security
|
7 | 7 | #customer intent: As a Windows app developer, I want to learn how to implement OAuth 2.0 functionality in my app so that I can securely authenticate users and access protected resources.
|
8 | 8 | ---
|
9 | 9 |
|
10 | 10 | # Implement OAuth 2.0 functionality in Windows apps
|
11 | 11 |
|
12 |
| -The new OAuth2Manager in Windows App SDK enables desktop applications such as WinUI to seamlessly perform OAuth 2.0 authorization across diverse Windows platforms. **OAuth2Manager** API intentionally doesn't provide APIs for the implicit request and resource owner password credential because of the security concerns that entails. It's recommended to use the authorization code grant type using Proof Key for Code Exchange (PKCE). For more information, see the [PKCE RFC](https://tools.ietf.org/html/rfc7636). |
| 12 | +The new [OAuth2Manager](/windows/windows-app-sdk/api/winrt/microsoft.security.authentication.oauth.oauth2manager) in Windows App SDK enables desktop applications such as WinUI 3 to seamlessly perform OAuth 2.0 authorization on Windows. **OAuth2Manager** API intentionally doesn't provide APIs for the implicit request and resource owner password credential because of the security concerns that entails. It's recommended to use the authorization code grant type using Proof Key for Code Exchange (PKCE). For more information, see the [PKCE RFC](https://tools.ietf.org/html/rfc7636). |
13 | 13 |
|
14 | 14 | ## OAuth background
|
15 | 15 |
|
16 |
| -The current WinRT [WebAuthenticationBroker](/uwp/api/windows.security.authentication.web.webauthenticationbroker), primarily designed for UWP applications, presents several challenges when used in desktop environments. Key issues include the dependency on ApplicationView, which are not compatible with desktop app frameworks. As a result, developers are forced to resort to workarounds involving interop interfaces and additional code to implement OAuth 2.0 functionality into their WinUI 3 desktop applications. |
| 16 | +The current WinRT [WebAuthenticationBroker](/uwp/api/windows.security.authentication.web.webauthenticationbroker), primarily designed for UWP apps, presents several challenges when used in desktop apps. Key issues include the dependency on [ApplicationView](/uwp/api/windows.ui.viewmanagement.applicationview), which isn't compatible with desktop app frameworks. As a result, developers are forced to resort to workarounds involving interop interfaces and additional code to implement OAuth 2.0 functionality into WinUI 3 and other desktop apps. |
17 | 17 |
|
18 | 18 | ## OAuth2Manager API in Windows App SDK
|
19 | 19 |
|
20 |
| -The OAuth2Manager API for Windows App SDK aims to provide a streamlined solution that meets the expectations of developers. It offers seamless OAuth 2.0 capabilities with full feature parity across all Windows platforms supported by Windows App SDK. The new API eliminates the need for cumbersome workarounds and simplifies the process of incorporating OAuth 2.0 functionality into desktop applications. |
| 20 | +The OAuth2Manager API for Windows App SDK aims to provide a streamlined solution that meets the expectations of developers. It offers seamless OAuth 2.0 capabilities with full feature parity across all Windows platforms supported by Windows App SDK. The new API eliminates the need for cumbersome workarounds and simplifies the process of incorporating OAuth 2.0 functionality into desktop apps. |
21 | 21 |
|
22 | 22 | The OAuth2Manager is different than the existing WinRT [WebAuthenticationBroker](/uwp/api/windows.security.authentication.web.webauthenticationbroker). It follows OAuth best practices more closely - e.g. using the user's default browser. The best practices for the API are taken from the IETF (Internet Engineering Task Force) OAuth 2.0 Authorization Framework [RFC 6749](https://tools.ietf.org/html/rfc6749), PKCE [RFC 7636](https://tools.ietf.org/html/rfc7636), and OAuth 2.0 for Native Apps [RFC 8252](https://tools.ietf.org/html/rfc8252).
|
23 | 23 |
|
@@ -311,4 +311,6 @@ protected override void OnActivated(IActivatedEventArgs args)
|
311 | 311 |
|
312 | 312 | ## Related content
|
313 | 313 |
|
314 |
| -[WebAuthenticationBroker](/uwp/api/windows.security.authentication.web.webauthenticationbroker) |
| 314 | +- [WebAuthenticationBroker](/uwp/api/windows.security.authentication.web.webauthenticationbroker) |
| 315 | +- [OAuth2Manager](/windows/windows-app-sdk/api/winrt/microsoft.security.authentication.oauth.oauth2manager) |
| 316 | +- [PKCE RFC 7636](https://tools.ietf.org/html/rfc7636) |
0 commit comments