向 firebase 用户添加新数据 [英] Adding new data to firebase users
问题描述
我想向 Firebase 身份验证添加一个新数据,其中包含显示名称、电话号码、图像等数据.但我想添加更多这样的性别,生日等等.可以添加新的吗?
I want to add a new data to firebase authentication which has data like displayname, phone number, image. But i want to add more such gender, birthday and more. is it possible to add new?
推荐答案
无法向 Firebase 身份验证用户配置文件添加任意附加数据.如果需要,请考虑使用 Firebase 实时数据库(或 Cloud Firestore)来存储其他信息.
There is no way to add arbitrary additional data to Firebase Authentication user profiles. If you want that, consider using the Firebase Realtime Database (or Cloud Firestore) for storing the additional information.
这种方法在过去的很多问题中都有涉及,所以我将链接到这些问题:
This approach has been covered in quite a few questions in the past, so I'll link you to those:
- Firebase:设置其他用户属性
- 使用 firebase 添加额外的用户信息
- 我如何将每个用户链接到他们在 Firebase 中的数据?
- Swift &Firebase - 如何存储除电子邮件和密码以外的更多用户数据?
- 在 Android 中注册 Firebase 期间存储其他信息一个>
- 如何向 firebase.auth() 添加额外信息一个>
几周前,您可以向 Firebase 身份验证用户配置文件添加少量信息.虽然这听起来像是您所需要的,但它明确不用于存储您需要的用户元数据.相反,它用于存储所谓的声明:有关用户的属性,然后您可以在安全规则中访问这些属性.请参阅有关设置自定义声明的文档.
Since a few weeks ago you can add small bits of information to the Firebase Authentication user profile. While this might sound like what you need, it is explicitly not meant for storing user metadata such as you need. Instead this is intended for storing so-called claims: properties about the user that you then access in the security rules. See the documentation for setting custom claims.
这篇关于向 firebase 用户添加新数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!