【发布时间】:2016-11-28 07:20:39
【问题描述】:
Firebase v3 Auth 提供了一个 updateProfile 方法,可将 displayName 和 photoURL 传递给 Firebase。
我的理解是,这些属性是在用户登录时从第三方 oAuth 提供商 Google、Facebook、Twitter 或 GitHub 检索的。如果是基于密码的身份验证,则无法在管理控制台中使用或查看它们。
我可以为密码身份验证帐户存储此信息吗?如果可以,我可以通过管理控制台查看/管理此信息吗?
顺便说一句:我知道这可以存储在实时数据库中的 users 节点/分支下,但我想问的是如何将此信息存储在 Firebase 身份验证系统中。
// Updates the user attributes:
user.updateProfile({
displayName: "Jane Q. User",
photoURL: "https://example.com/jane-q-user/profile.jpg"
}).then(function() {
// Profile updated successfully!
// "Jane Q. User"
var displayName = user.displayName;
// "https://example.com/jane-q-user/profile.jpg"
var photoURL = user.photoURL;
}, function(error) {
// An error happened.
});
// Passing a null value will delete the current attribute's value, but not
// passing a property won't change the current attribute's value:
// Let's say we're using the same user than before, after the update.
user.updateProfile({photoURL: null}).then(function() {
// Profile updated successfully!
// "Jane Q. User", hasn't changed.
var displayName = user.displayName;
// Now, this is null.
var photoURL = user.photoURL;
}, function(error) {
// An error happened.
});
【问题讨论】:
标签: firebase firebase-authentication