Swift & Firebase - How to store more user data other than email and password?

前端 未结 1 887
花落未央
花落未央 2020-12-18 07:42

I\'m relatively new to Firebase and trying to develop an app which requires users to give their name and surname in sign up page. But firebase createUserWithEmail method onl

相关标签:
1条回答
  • 2020-12-18 08:36

    Yes, you need to use the realtime database to store your user data. So after creating it you can call the setValue().

    FIRAuth.auth()!.createUserWithEmail(email, password: pwd, completion: { authData, error  in
        if error == nil {    
            let userData = ["name": name,
                            "surname ": surname]
            let ref = FIRDatabase.database().reference()
            ref.child('users').child(authData!.uid).setValue(userData)
        } else {
            // handle error
        }
    })
    
    0 讨论(0)
提交回复
热议问题