From 46cef64e1eeaf683b348b8ff072768fe7b746f29 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Mon, 6 Nov 2023 17:03:00 +0100 Subject: [PATCH] update --- articles/quickstart/native/maui/files/main-page.md | 5 +++++ articles/quickstart/native/maui/interactive.md | 14 ++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/articles/quickstart/native/maui/files/main-page.md b/articles/quickstart/native/maui/files/main-page.md index 34276d7b6d..6bb02cb95e 100644 --- a/articles/quickstart/native/maui/files/main-page.md +++ b/articles/quickstart/native/maui/files/main-page.md @@ -58,6 +58,11 @@ public partial class MainPage : ContentPage return; } + var user = loginResult.User; + var name = user.FindFirst(c => c.Type == "name")?.Value; + var email = user.FindFirst(c => c.Type == "email")?.Value; + var picture = user.FindFirst(c => c.Type == "picture")?.Value; + LogoutBtn.IsVisible = true; LoginBtn.IsVisible = false; diff --git a/articles/quickstart/native/maui/interactive.md b/articles/quickstart/native/maui/interactive.md index 813b5709d3..01ea3271b8 100644 --- a/articles/quickstart/native/maui/interactive.md +++ b/articles/quickstart/native/maui/interactive.md @@ -196,18 +196,8 @@ Still having issues? Check out our [documentation](https://auth0.com/docs) or vi :::: -## Show User Profile Information +## Show User Profile Information {{{ data-action="code" data-code="MainPage.xaml.cs#55-58" }}} Now that your users can log in and log out, you will likely want to be able to retrieve the [profile information](https://auth0.com/docs/users/concepts/overview-user-profile) associated with authenticated users. For example, you may want to be able to display a logged-in user’s name or profile picture in your project. -The Auth0 SDK for MAUI provides user information through the `LoginResult.User` property. - -```csharp -if (loginResult.IsError == false) -{ - var user = loginResult.User; - var name = user.FindFirst(c => c.Type == "name")?.Value; - var email = user.FindFirst(c => c.Type == "email")?.Value; - var picture = user.FindFirst(c => c.Type == "picture")?.Value; -} -``` \ No newline at end of file +The Auth0 SDK for MAUI provides user information through the `LoginResult.User` property. \ No newline at end of file