简体   繁体   English

将“全名”字段添加到 Firebase 电子邮件/密码身份验证?

[英]Add a "Full Name" Field to Firebase Email/Password Authentication?

Is there a way to add a "Full Name" field to the Email/Password authentication on Firebase?有没有办法在 Firebase 的电子邮件/密码身份验证中添加“全名”字段? (Using Swift) (使用斯威夫特)

You cannot add your own custom field to the Firebase Authentication social providers (Facebook, Google, etc) or email+password. 您无法将自己的自定义字段添加到Firebase身份验证社交提供程序(Facebook,Google等)或电子邮件+密码。 You can of course store such information in your Firebase Database, keyed by the user's ID: 当然,您可以将此类信息存储在Firebase数据库中,并以用户ID进行键入:

users
  uid_209103
    fullName: "Frank van Puffelen"

Note that Firebase Authentication already has a displayName property for each user, which may cover your needs. 请注意,Firebase身份验证已经为每个用户提供了displayName属性 ,该属性可以满足您的需求。

We cannot add a new field in Firebase Authentication.我们无法在 Firebase 身份验证中添加新字段。 However, you can still store a user's full name, Firebase does provide this facility.但是,您仍然可以存储用户的全名,Firebase 确实提供了此功能。 Either you can use Firebase Database to store a user's information as Frank van Puffelen stated in his answer above.您可以使用 Firebase 数据库来存储用户的信息,如Frank van Puffelen在他上面的回答中所述。

Or if you are just trying to save user's name, you can update User's profile (DisplayName and ProfilePhoto link).或者,如果您只是想保存用户名,则可以更新用户的个人资料(DisplayName 和 ProfilePhoto 链接)。 For iOS, Update User's Profile in FirebaseAuth对于 iOS, 更新 FirebaseAuth 中的用户配置文件

For Android, Update User's Profile in FirebaseAuth对于 Android, 更新 FirebaseAuth 中的用户配置文件

It comes in handy when you have a basic app and you want to store only little information about the user such as their Display Name or Profile Profile only.当您有一个基本应用程序并且只想存储有关用户的少量信息(例如他们的显示名称或个人资料)时,它会派上用场。 What I do is, after creating a new user, update the user's profile immediately.我所做的是,在创建新用户后,立即更新用户的个人资料。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM