如何在 firebase 中向用户添加自定义配置文件详细信息?
How to add custom profile details to the user in firebase?
如何在 firebase 中向用户添加自定义配置文件详细信息?我知道我们已经可以添加 displayName 和 photoURL,但我想添加更多字段,例如年龄、性别、国家/地区等。有什么办法可以做到吗?
user.updateProfile({
displayName: "Jane Q. User",
photoURL: "https://example.com/jane-q-user/profile.jpg"
}).then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
您可以创建一个 users
端点并在其中存储自定义用户数据。
function writeUserData(userId, name, email, imageUrl) {
firebase.database().ref('users/' + userId).set({
username: name,
email: email,
profile_picture : imageUrl,
// Add more stuff here
});
}
有关详细信息,请参阅 https://firebase.google.com/docs/database/web/read-and-write#basic_write。
如何在 firebase 中向用户添加自定义配置文件详细信息?我知道我们已经可以添加 displayName 和 photoURL,但我想添加更多字段,例如年龄、性别、国家/地区等。有什么办法可以做到吗?
user.updateProfile({
displayName: "Jane Q. User",
photoURL: "https://example.com/jane-q-user/profile.jpg"
}).then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
您可以创建一个 users
端点并在其中存储自定义用户数据。
function writeUserData(userId, name, email, imageUrl) {
firebase.database().ref('users/' + userId).set({
username: name,
email: email,
profile_picture : imageUrl,
// Add more stuff here
});
}
有关详细信息,请参阅 https://firebase.google.com/docs/database/web/read-and-write#basic_write。