A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/realm-sdks/dotnet/latest/reference/Realms.Sync.User.html below:

Class User | Realm

Class User

This class represents a user in a Atlas App Services application. The credentials are provided by various 3rd party providers (Facebook, Google, etc.). A user can log in to the server and, if access is granted, it is possible to synchronize the local and the remote Realm. Moreover, synchronization is halted when the user is logged out. It is possible to persist a user. By retrieving a user, there is no need to log in to the 3rd party provider again. Persisting a user between sessions, the user's credentials are stored locally on the device, and should be treated as sensitive data.

Namespace: Realms.Sync Assembly: Realm.dll Syntax
public class User : IEquatable<User>
Properties | Edit this page View Source AccessToken

Gets this user's access token. This is the user's credential for accessing MongoDB Atlas data and should be treated as sensitive information.

Declaration
public string AccessToken { get; }
Property Value Type Description string

A unique string that can be used to represent this user before the server.

| Edit this page View Source ApiKeys

Gets a User.ApiKeyClient instance that exposes functionality for managing user API keys.

Declaration
public User.ApiKeyClient ApiKeys { get; }
Property Value See Also | Edit this page View Source App

Gets the app with which this user is associated.

Declaration Property Value Type Description App

An App instance that owns this user.

| Edit this page View Source DeviceId

Gets a unique identifier for the device the user logged in to.

Declaration
public string DeviceId { get; }
Property Value Type Description string

A unique string that identifies the current device.

| Edit this page View Source Functions

Gets a User.FunctionsClient instance that exposes functionality for calling remote Atlas Functions.

Declaration
public User.FunctionsClient Functions { get; }
Property Value See Also | Edit this page View Source Id

Gets the Id of this user in Atlas App Services.

Declaration
public string Id { get; }
Property Value Type Description string

A string that uniquely identifies that user.

| Edit this page View Source Identities

Gets a collection of all identities associated with this user.

Declaration
public UserIdentity[] Identities { get; }
Property Value | Edit this page View Source Profile

Gets the profile information for that user.

Declaration
public UserProfile Profile { get; }
Property Value Type Description UserProfile

A UserProfile object, containing information about the user's name, email, and so on.

| Edit this page View Source Provider

Gets a value indicating which Credentials.AuthProvider this user logged in with.

Declaration
[Obsolete("User.Provider wasn't working consistently and will be removed in a future version. You can get the provider of the user identity instead.")]
public Credentials.AuthProvider Provider { get; }
Property Value | Edit this page View Source RefreshToken

Gets this user's refresh token. This is the user's credential for accessing MongoDB Atlas data and should be treated as sensitive information.

Declaration
public string RefreshToken { get; }
Property Value Type Description string

A unique string that can be used for refreshing the user's credentials.

| Edit this page View Source State

Gets the current state of the user.

Declaration
public UserState State { get; }
Property Value Type Description UserState

A value indicating whether the user is active, logged out, or an error has occurred.

Methods | Edit this page View Source Equals(User?)

Determines whether this instance and another User instance are equal by comparing their identities.

Declaration
public bool Equals(User? other)
Parameters Type Name Description User other

The User instance to compare with.

Returns Type Description bool

true if the two instances are equal; false otherwise.

| Edit this page View Source GetCustomData()

Gets the custom user data associated with this user in the Realm app.

Declaration
public BsonDocument? GetCustomData()
Returns Type Description BsonDocument

A document containing the user data.

See Also | Edit this page View Source GetCustomData<T>()

Gets the custom user data associated with this user in the Realm app and parses it to the specified type.

Declaration
public T? GetCustomData<T>() where T : class
Returns Type Description T

A document containing the user data.

Type Parameters Name Description T

The managed type that matches the shape of the custom data documents.

See Also | Edit this page View Source GetMongoClient(string)

Gets a MongoClient instance for accessing documents in a MongoDB database.

Declaration
public MongoClient GetMongoClient(string serviceName)
Parameters Type Name Description string serviceName

The name of the service as configured on the server.

Returns Type Description MongoClient

A MongoClient instance that can interact with the databases exposed in the remote service.

| Edit this page View Source LinkCredentialsAsync(Credentials)

Links the current user with a new user identity represented by the given credentials.

Declaration
public Task<User> LinkCredentialsAsync(Credentials credentials)
Parameters Type Name Description Credentials credentials

The credentials to link with the current user.

Returns Type Description Task<User>

An awaitable Task<TResult> representing the remote link credentials operation. Upon successful completion, the task result will contain the user to which the credentials were linked.

Examples

The following snippet shows how to associate an email and password with an anonymous user allowing them to login on a different device.

var app = App.Create("app-id")
var user = await app.LogInAsync(Credentials.Anonymous());

// This step is only needed for email password auth - a password record must exist
// before you can link a user to it.
await app.EmailPasswordAuth.RegisterUserAsync("email", "password");
await user.LinkCredentialsAsync(Credentials.EmailPassword("email", "password"));
| Edit this page View Source LogOutAsync()

Removes the user's local credentials and attempts to invalidate their refresh token from the server.

Declaration
public Task LogOutAsync()
Returns Type Description Task

An awaitable Task that represents the remote logout operation.

| Edit this page View Source RefreshCustomDataAsync()

Re-fetch the user's custom data from the server.

Declaration
public Task<BsonDocument?> RefreshCustomDataAsync()
Returns Type Description Task<BsonDocument>

An awaitable Task<TResult> that represents the remote refresh operation. The result is a MongoDB.Bson.BsonDocument containing the updated custom user data. The value returned by GetCustomData() will also be updated with the new information.

| Edit this page View Source RefreshCustomDataAsync<T>()

Re-fetch the user's custom data from the server.

Declaration
public Task<T?> RefreshCustomDataAsync<T>() where T : class
Returns Type Description Task<T>

An awaitable Task<TResult> that represents the remote refresh operation. The result is an object containing the updated custom user data. The value returned by GetCustomData<T>() will also be updated with the new information.

Type Parameters Name Description T

The managed type that matches the shape of the custom data documents.

| Edit this page View Source ToString()

Returns a string that represents the current object.

Declaration
public override string ToString()
Returns Type Description string

A string that represents the current object.

Overrides Events | Edit this page View Source Changed

Occurs when a property value changes.

Declaration
public event EventHandler? Changed
Event Type Operators | Edit this page View Source operator ==(User?, User?)

Determines whether two User instances are equal.

Declaration
public static bool operator ==(User? user1, User? user2)
Parameters Type Name Description User user1

The first user to compare.

User user2

The second user to compare.

Returns Type Description bool

true if the two instances are equal; false otherwise.

| Edit this page View Source operator !=(User?, User?)

Determines whether two User instances are different.

Declaration
public static bool operator !=(User? user1, User? user2)
Parameters Type Name Description User user1

The first user to compare.

User user2

The second user to compare.

Returns Type Description bool

true if the two instances are different; false otherwise.

Implements

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4