Beispiel #1
0
        /// <summary>
        /// Update an existing user.
        /// </summary>
        /// <exception cref="FirebaseAuthException">If the server responds that cannot update the
        /// user.</exception>
        /// <param name="args">The user account data to be updated.</param>
        /// <param name="cancellationToken">A cancellation token to monitor the asynchronous
        /// operation.</param>
        internal async Task <string> UpdateUserAsync(
            UserRecordArgs args, CancellationToken cancellationToken = default(CancellationToken))
        {
            var payload  = args.ToUpdateUserRequest();
            var response = await this.PostAndDeserializeAsync <JObject>(
                "accounts:update", payload, cancellationToken).ConfigureAwait(false);

            if (payload.Uid != (string)response.Result["localId"])
            {
                throw UnexpectedResponseException(
                          $"Failed to update user: {payload.Uid}", resp: response.HttpResponse);
            }

            return(payload.Uid);
        }