According to Firebase site, I am using this code to create a new user:
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {});
How can I add display name and photo url to Auth when creating the new user?
This link shows the supported user data returned from an identity provider in Auth.
You can use Firebase Authentication to let your users authenticate with Firebase using their email addresses and passwords and to manage your app’s password-based accounts. Firebase allows you to create a fast and secure authentication system with its vast API collection.
The createUserWithEmailAndPassword function only creates a new user in Firebase authentication service. The database itself isn't changed at all as a result. firebase.database ().ref ("users").child (user.uid).set (...)
You create a new user in your Firebase project by calling the createUserWithEmailAndPassword method or by signing in a user for the first time using a federated identity provider, such as Google Sign-In or Facebook Login.
I’ve created 2 methods using Firebase createUserWithEmailAndPassword (email, password) and signInWithEmailAndPassword (email, password) APIs. SignUp (email, password): This method creates a new user with email and password using Firebase API with Angular. SignIn (email, password): This method allows a user to sign in with email and password.
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.
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With