在Firebase身份验证(android)之后创建数据库中的用户 [英] Create user in database after Firebase Auth (android)
问题描述
我正在构建一个Android应用程序,我希望我的用户能够被Auth添加到数据库中。现在,我只使用电子邮件和密码进行身份验证,然后单击注册,并在Firebase控制台的身份验证部分创建用户。
但是我也希望我的用户被添加到数据库中。我想添加更多的字段(如姓名,地址等),这些字段将存储在Firebase的用户数据库中。
我真的不知道该怎么做那。任何人都可以解释一下吗?
谢谢!
用户:{
userID1:{
name :'Raph'
},
userID2:{
name:'Devid'
}
}
每个记录的用户都有一个唯一的 uid
,您可以将其用作关键字。您可以在登录用户时在authToken中找到它。
注意这只是Firebase中用于保存的正常节点用户的数据。
这是 Firebase生成的用户。
I'm building an Android app and I want my users to be Auth then added to the database. For now I'm only doing the Auth with an email and password, then I click register and the user is created in the Auth section in the Firebase console.
But I also want my users to be added in the database. I want to add more fields (such as name, address etc) which will be stored in the users database in Firebase.
I just don't really see how to do that. Anyone could explain please?
Thanks!
You should create a node where you save your users, like this:
users: {
userID1: {
name: 'Raph'
},
userID2: {
name: 'Devid'
}
}
Every logged user has a unique uid
that you can use as key. You can find it in the authToken when you log your user in.
NOTE this is just a normal node in Firebase that you use to save user's data. It is an alternative solution to the Firebase generated users.
这篇关于在Firebase身份验证(android)之后创建数据库中的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!