Skip to content

Commit

Permalink
Update WPF and WinForms quickstart to .NET6 (#10303)
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck authored Sep 15, 2023
1 parent 7a65171 commit 76c6412
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
15 changes: 1 addition & 14 deletions articles/quickstart/native/wpf-winforms/01-login.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Login
default: true
description: This tutorial demonstrates how to add user login to a Windows Forms C# application using Auth0.
description: This tutorial demonstrates how to add user login to a WPF and Windows Forms C# application using Auth0.
budicon: 448
topics:
- quickstarts
Expand Down Expand Up @@ -41,10 +41,6 @@ To integrate Auth0 login into your application, simply instantiate an instance o

${snippet(meta.snippets.setup)}

::: note
By default, the SDK uses WebView (non-chromium Edge) as a Browser. If you wish to use Chromium Edge, you can implement [WebView2](https://docs.microsoft.com/en-us/microsoft-edge/webview2/) as explained on [this Auth0 Community post](https://community.auth0.com/t/howto-use-the-auth0-oidcclient-winforms-sdk-with-edge-chromium-webview2/57746).
:::

You can then call the `LoginAsync` method to log the user in:

${snippet(meta.snippets.use)}
Expand All @@ -62,8 +58,6 @@ The returned login result will indicate whether authentication was successful, a
You can check the `IsError` property of the result to see whether the login has failed. The `ErrorMessage` will contain more information regarding the error which occurred.

```csharp
// Form1.cs
var loginResult = await client.LoginAsync();

if (loginResult.IsError)
Expand All @@ -77,8 +71,6 @@ if (loginResult.IsError)
On successful login, the login result will contain the ID Token and Access Token in the `IdentityToken` and `AccessToken` properties respectively.

```csharp
// Form1.cs
var loginResult = await client.LoginAsync();

if (!loginResult.IsError)
Expand All @@ -95,8 +87,6 @@ On successful login, the login result will contain the user information in the `
To obtain information about the user, you can query the claims. You can for example obtain the user's name and email address from the `name` and `email` claims:

```csharp
// Form1.cs
if (!loginResult.IsError)
{
Debug.WriteLine($"name: {loginResult.User.FindFirst(c => c.Type == "name")?.Value}");
Expand All @@ -111,8 +101,6 @@ The exact claims returned will depend on the scopes that were requested. For mor
You can obtain a list of all the claims contained in the ID Token by iterating through the `Claims` collection:

```csharp
// Form1.cs
if (!loginResult.IsError)
{
foreach (var claim in loginResult.User.Claims)
Expand All @@ -127,6 +115,5 @@ if (!loginResult.IsError)
To log the user out call the `LogoutAsync` method.

```csharp
// Form1.cs
await client.LogoutAsync();
```
3 changes: 2 additions & 1 deletion articles/quickstart/native/wpf-winforms/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ sdk:
url: https://github.com/auth0/auth0-oidc-client-net
logo: windows
requirements:
- Microsoft Visual Studio 2017
- Microsoft Visual Studio 2022
- .NET Framework 4.6.2
- .NET 6
next_steps:
- path: 01-login
list:
Expand Down

0 comments on commit 76c6412

Please sign in to comment.