1

I'm implementing an Authenticate with Firebase using Password-Based Accounts on iOS. After sign-in a user we can get particular information like user.email, user.uid, user.photoURL, user.displayName. However I can set email and password as follows.

[[FIRAuth auth]
     createUserWithEmail:username
     password:password
     completion:^(FIRUser *_Nullable user,
                  NSError *_Nullable error) {

     }];

In here no problem to get user.email. But I didn't set other information here. How to set other information such as user.photoURL, user.displayName with above createUserWithEmail method.

isuru
  • 3,385
  • 4
  • 27
  • 62

2 Answers2

1

You need to call FIRUserProfileChangeRequest after the user authentication to update the profile info.

FIRUserProfileChangeRequest *changeRequest =
    [[FIRAuth auth].currentUser profileChangeRequest];
changeRequest.displayName = userInput;
[changeRequest commitChangesWithCompletion:^(NSError *_Nullable error) {
  // ...
}];

Read more on https://firebase.google.com/docs/auth/ios/manage-users

Jen Jose
  • 3,995
  • 2
  • 19
  • 36
0

You can check my answer here. It can help You. But its on Swift language.

Main tip that You need to store Users in database too. And have a link to image in it.

Hope it helps

Community
  • 1
  • 1
Vlad Pulichev
  • 3,162
  • 2
  • 20
  • 34