尝试按照 Firebase 文档更新用户的 photoURL。但是,当我更新时,它只返回 null。
editProfilePicture(){
const user = firebase.auth().currentUser;
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.
});
}
我使用返回 photoURL <ProfilePicture image={currentUser && currentUser.photoURL} />
的组件渲染图像。 。
当前用户是const { currentUser } = firebase.auth()
,这非常适合 displayName
..
我做错了什么?
最佳答案
如果您使用谷歌身份验证,它会正常工作,但如果您仅使用电子邮件和密码身份验证,它无法返回用户配置文件(null),因为您只是自己初始化电子邮件和密码,您的应用程序只是借用您的电子邮件。
关于javascript - Firebase Auth photoURL 始终返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53215287/