Firebase Create User with Email, Password, Display Name and Photo Url

Creating User with Email, password, display name and photoURL

Instead of creating the users directly from the client, you can use a callable function to create users using the Admin SDK, which includes displayName and photoURL in its options.

Firebase create user with email, password, display name and photo url

You can update your profile with FIRUserProfileChangeRequest class .. check this Doc.

let user = FIRAuth.auth()?.currentUser
if let user = user {
let changeRequest = user.profileChangeRequest()

changeRequest.displayName = "Jane Q. User"
changeRequest.photoURL =
NSURL(string: "https://example.com/jane-q-user/profile.jpg")
changeRequest.commitChangesWithCompletion { error in
if let error = error {
// An error happened.
} else {
// Profile updated.
}
}
}

How can I add the displayName to the Firebase user? (Flutter/Dart)

You can use updateProfile method given in the FirebaseUser class to update the name and photo url.

updateProfile({String displayName, String photoURL}).

For email you can use the different method
updateEmail(String newEmail) which is a async method.

Or to save the username directly into the firestore, after successful login you can use 'set' method of the FirebaseFirestore to save email, password and the username.

Angular 8 /Firebase: how do I set the displayName when creating user with email and password?

If you wan to set the display name of a user account, you won't be able to do that at the time of account creation using createUserWithEmailAndPassword. You'll have to perform a followup call to updateProfile() on the user object you get back.

result.user.updateProfile({
displayName: ...
})
.then(...)
.catch(...)

You will obviously have to pass along the name in the call to registerUser().

Flutter + Firebase How can I add DisplayName when creating account with Email and Password

You can add the display name to firebase auth using the following code:

await FirebaseAuth.instance.currentUser.updateProfile(displayName: "JohnDoe");

If you decide to add a display photo in future you can do so by :

await FirebaseAuth.instance.currentUser.updateProfile(displayName: "JohnDoe",photoURL: "URL of the photo");

You can access the name and image URL using the following code:

User user = FirebaseAuth.instance.currentUser;
String name = user.displayName;
String imgUrl = user.photoURL;


Related Topics



Leave a reply



Submit