/// <summary> /// Logs in as a user with the given credentials associated with an authentication provider. /// </summary> /// <remarks> /// The last logged in user will be saved as <see cref="CurrentUser"/>. If there was already a current user, /// that user is still logged in and can be found in the list returned by <see cref="AllUsers"/>. It is also /// possible to switch between which user is considered the current user by using <see cref="SwitchUser(User)"/>. /// </remarks> /// <param name="credentials">The <see cref="Credentials"/> representing the type of login.</param> /// <returns> /// An awaitable <see cref="Task{T}"/> that represents the asynchronous LogIn operation.</returns> public async Task <User> LogInAsync(Credentials credentials) { Argument.NotNull(credentials, nameof(credentials)); var handle = await Handle.LogInAsync(credentials.ToNative()); return(new User(handle, this)); }
/// <summary> /// Logs in as a user with the given credentials associated with an authentication provider. /// </summary> /// <remarks> /// The last logged in user will be saved as <see cref="CurrentUser"/>. If there was already a current user, /// that user is still logged in and can be found in the list returned by <see cref="AllUsers"/>. It is also /// possible to switch between which user is considered the current user by using <see cref="SwitchUser(User)"/>. /// </remarks> /// <param name="credentials">The <see cref="Credentials"/> representing the type of login.</param> /// <returns> /// An awaitable <see cref="Task{T}"/> that represents the asynchronous LogIn operation.</returns> public async Task <User> LogInAsync(Credentials credentials) { Argument.NotNull(credentials, nameof(credentials)); var tcs = new TaskCompletionSource <SyncUserHandle>(); Handle.LogIn(credentials.ToNative(), tcs); var handle = await tcs.Task; return(new User(handle, this)); }