Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck committed Nov 6, 2023
1 parent 5083245 commit 46cef64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
5 changes: 5 additions & 0 deletions articles/quickstart/native/maui/files/main-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 2 additions & 12 deletions articles/quickstart/native/maui/interactive.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
```
The Auth0 SDK for MAUI provides user information through the `LoginResult.User` property.

0 comments on commit 46cef64

Please sign in to comment.