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
Copy file name to clipboardExpand all lines: articles/quickstart/native/windows-uwp-csharp/interactive.md
+98-1Lines changed: 98 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,103 @@ locale: en-US
11
11
12
12
# Add Login to Your UWP application
13
13
14
-
15
14
<p>This tutorial demonstrates how to add user login to a UWP C# application using Auth0. We recommend that you log in to follow this quickstart with examples configured for your account.</p><h2>System Requirements</h2><p>This tutorial and sample project have been tested with the following:</p><ul><li><p>Microsoft Visual Studio 2022</p></li><li><p>Windows 10 SDK (10.0.26100.0)</p></li><li><p>Auth0.OidcClient.UWP 4.0.0</p></li></ul><div></div><p></p>
If you are following along with the sample project you downloaded from the top of this page, you should set the **Allowed Callback URLs** to `https://${account.namespace}/mobile`.
Use the NuGet Package Manager Console (Tools -> NuGet Package Manager -> Package Manager Console) to install the `Auth0.OidcClient.UWP` package, running the command:
This loads the Auth0 login page into a web view. You can learn how to customize the login page at <ahref="/universal-login#simple-customization"target="_blank"rel="noreferrer">this document</a>.
49
+
50
+
## Handle Authentication Tokens
51
+
52
+
The returned login result indicates whether authentication was successful, and if so contains the tokens and claims of the user.
53
+
54
+
### Authentication Error
55
+
56
+
You can check the `IsError` property of the result to see whether the login has failed. The `ErrorMessage` contains more information regarding the error which occurred.
57
+
58
+
```csharp
59
+
if (loginResult.IsError)
60
+
{
61
+
Debug.WriteLine($"An error occurred during login: {loginResult.Error}")
62
+
}
63
+
```
64
+
65
+
### Accessing the tokens
66
+
67
+
On successful login, the login result contains the ID Token and Access Token in the `IdentityToken` and `AccessToken` properties respectively.
On successful login, the login result contains the user information in the `User` property, which is a <ahref="https://msdn.microsoft.com/en-us/library/system.security.claims.claimsprincipal(v=vs.110).aspx"target="_blank"rel="noreferrer">ClaimsPrincipal</a>.
80
+
81
+
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:
0 commit comments