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

后端 未结 6 1150
死守一世寂寞
死守一世寂寞 2020-12-15 07:17

According to Firebase site, I am using this code to create a new user:

firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error)          


        
6条回答
  •  醉梦人生
    2020-12-15 07:38

    Simply you can solve your problem as follow.

    1) Create a user using following statement.

    firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {});
    

    2) success of above statement Please authenticate this user as follow.

         self.rootRef.authUser(email, password)
     // USER_ID = Here you get user_ID
    

    3) Success of above function set user name and profile picture to user as follow.

      usersRef.updateChildValues(dict, withCompletionBlock:
    

    -Here userRef contain your userDetails/USER_ID

    Might be work for you. i have code but work for older firebase version so not work for you otherwise i had share with you.

提交回复
热议问题