Beispiel #1
0
        public async Task <(bool successful, string message)> TryCreateAccount(string displayName, string email, string password)
        {
            if (IsLoggedIn)
            {
                return(false, "Already logged in.");
            }

            try
            {
                var credential = await _authClient.CreateUserWithEmailAndPasswordAsync(email, password, displayName);

                SetUser(credential);
            }
            catch (FirebaseAuthException ex)
            {
                return(false, $"Unhandled error occured during sign up -> {ex.Reason}");
            }

            if (IsLoggedIn)
            {
                return(true, $"Signed in as {UserName}.");
            }
            else
            {
                return(false, "Failed to create account.");
            }
        }
 public async Task <UserCredential> CreateUserAsyc(string email, string password)
 {
     return(await _client.CreateUserWithEmailAndPasswordAsync(email, password).ConfigureAwait(false));
 }