Ron*_*ton 6 firebase firebase-authentication
火力地堡V3验证提供的updateProfile是通过方法displayName和photoURL对火力地堡.
我的理解是,这些属性是在用户登录时从第三方oAuth提供商Google,Facebook,Twitter或GitHub中检索到的.如果是基于密码的身份验证,则无法从管理控制台访问或查看这些身份验证.
我可以存储密码验证帐户的此信息吗?如果可以,我可以通过管理控制台查看/管理此信息吗?
顺便说一句:我知道这可以存储在users节点/分支下的实时数据库中,但我要求将这些信息存储在Firebase Auth系统中.
// 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.
});
Run Code Online (Sandbox Code Playgroud)
Ron*_*ton 14
.updateProfile在Firebase Auth系统中存储displayName和photoURL属性.因此,无需users在实时数据库中的节点下设置/获取此内容.
您不会在Firebase v3 Auth控制台中看到这些属性.这种方式不可见.
滚动到一个,这里如何注册密码用户:
registerPasswordUser(email,displayName,password,photoURL){
var user = null;
//nullify empty arguments
for (var i = 0; i < arguments.length; i++) {
arguments[i] = arguments[i] ? arguments[i] : null;
}
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(function () {
user = firebase.auth().currentUser;
user.sendEmailVerification();
})
.then(function () {
user.updateProfile({
displayName: displayName,
photoURL: photoURL
});
})
.catch(function(error) {
console.log(error.message);
});
console.log('Validation link was sent to ' + email + '.');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7034 次 |
| 最近记录: |