Esempio n. 1
0
        public async Task <bool> CreateUser(string username, string email, string password)
        {
            var authResult = await FirebaseAuth.Instance.CreateUserWithEmailAndPasswordAsync(email, password);

            var userProfileChangeRequestBuilder = new UserProfileChangeRequest.Builder();

            userProfileChangeRequestBuilder.SetDisplayName(username);
            var userProfileChangeRequest = userProfileChangeRequestBuilder.Build();
            await authResult.User.UpdateProfileAsync(userProfileChangeRequest);

            return(await Task.FromResult(true));
        }
        public async Task <string> Register(string eMail, string password, string name)
        {
            IAuthResult user = await FirebaseAuth.Instance.CreateUserWithEmailAndPasswordAsync(eMail, password);

            UserProfileChangeRequest.Builder profileUpdates = new UserProfileChangeRequest.Builder();
            profileUpdates.SetDisplayName(name);
            UserProfileChangeRequest updates = profileUpdates.Build();
            await user.User.UpdateProfileAsync(updates);

            var token = await user.User.GetIdTokenAsync(false);

            return(token.Token);
        }
        public async Task <FirebaseUser> CreateUserWithEmailPasswordAsync(string email, string password, string displayName)
        {
            _user = (await _firebaseAuth.CreateUserWithEmailAndPasswordAsync(email, password)).User;

            var request = new UserProfileChangeRequest.Builder();

            request.SetDisplayName(displayName);

            await _firebaseAuth.CurrentUser.UpdateProfileAsync(request.Build());

            SaveUser();

            return(User);
        }
        public void ChangeLogin(string text, IOnCompleteListener c)
        {
            FirebaseUser user = FirebaseAuth.Instance.CurrentUser;

            if (user != null)
            {
                UserProfileChangeRequest.Builder profileUpdates = new UserProfileChangeRequest.Builder();
                profileUpdates.SetDisplayName(text);
                UserProfileChangeRequest updates = profileUpdates.Build();
                user.UpdateProfile(updates).AddOnCompleteListener(c);
            }
            else
            {
                throw new Exception("Current user is null");
            }
        }