Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 436
Alex Avatar asked Jul 15 '16 06:07

Alex


People also ask

How do I use Firebase authentication?

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.

How does createuserwithemailandpassword work in Firebase?

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 (...)

How do I create a new user in my Firebase project?

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.

How to create user with email and password using angular Firebase API?

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.


1 Answers

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.
        }
      }
    }
like image 65
EI Captain v2.0 Avatar answered Sep 21 '22 09:09

EI Captain v2.0