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 methodupdateEmail(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
Passing Data to and from an Embedded Uiwebview
Apple Watch, Watchkit Extension and Main Application
How to Make Your Push Notification Open a Certain View Controller
Move Gmsmarker on Google Map Like Uber
Change the Listing Order of the View Controllers in Xcode Storyboard
How to Pass Swift Enum with @Objc Tag
How to Restrict the iOS App Only for iPhone Excluding iPad
Custom Init of Uiviewcontroller from Storyboard
Iphone: Push Notification Testing on Production Certificate
Using Cocoapods in an App Extension Using a Framework
Launching Phone/Email/Map Links in Wkwebview
Uitapgesturerecognizer Programmatically Trigger a Tap in My View
Becomefirstresponder Not Working in iOS 8
How to Properly Use Class Extensions in Swift
Dispatchqueue Crashing with Main.Sync in Swift
Ios: Does Force Quitting the App Disables Background Upload Using Nsurlsession
Delete a Device from My Developer Account to Increase the Count