Docs Menu

User Metadata - .NET SDK

On this page

  • Read a User's Metadata
  • Update User Metadata

You can read the user metadata of a currently logged-in user through the User object. You cannot edit user metadata through a User object.

The Profile property on the User object returns a UserProfile object of a logged-in user. The following example shows how to get a user's email from the metatdata:

var user = await app.LogInAsync(
Credentials.EmailPassword("user1@example.com", "p@ssw0rd"));
Console.WriteLine($"The user's email is {user.Profile.Email}");

User metadata options vary depending on which provider you're using and which metadata fields you enable.

Warning
User Metadata May Be Stale

App Services fetches the most recent version of user metadata when a user logs in. If the user changes their email address or profile photo with a login provider, for example, those changes do not update in user metadata until the user logs in again. Because we cache credentials and enable you to bypass the login flow, user metadata may become stale unless you force the user to log in again.

User metadata is read-only data. You cannot update or edit it. If you want to create editable user data, use custom user data instead.

←  Custom User Data - .NET SDKManage Email/Password Users - .NET SDK →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.