Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change what information FirebaseUI asks for when a user signs up?

I am making an app with firebase auth functionality for signing in and signing up . When I was searching , I came upon FireBase UI which seemed good . When I saw the auth documentation , the create user method accepted only Email ID and password , but the Firebase UI gets the First and last name of the user too. What does it do with the name entered? Is it stored somewhere in the auth or database or is it just for showcase? If I implement my own UI for sign up , can I add more details than just email id and password ?

like image 409
Sriram R Avatar asked Jan 20 '17 20:01

Sriram R


1 Answers

I am one of the developers of FirebaseUI.

In order to save the display name, FirebaseUI issues a UserProfileChangeRequest after sign in:

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
        .setDisplayName("Jane Q. User")
        .setPhotoUri(Uri.parse("https://example.com/jane-q-user/profile.jpg"))
        .build();

user.updateProfile(profileUpdates)
        .addOnCompleteListener(new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                if (task.isSuccessful()) {
                    Log.d(TAG, "User profile updated.");
                }
            }
        });

This allows for the storage of some basic fields like display name and photo URL. For custom fields, you will need to store the information in the Firebase Realtime Database.

https://firebase.google.com/docs/auth/android/manage-users#update_a_users_profile

like image 89
Sam Stern Avatar answered Nov 20 '22 04:11

Sam Stern