javascript - Firebase Auth photoURL 始终返回 null

标签 javascript firebase react-native firebase-authentication

尝试按照 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/

相关文章:

javascript - React 多个复选框的行为很奇怪,并且状态中添加了确认和取消功能

android - 即使在提供准确的客户端 ID 后仍获取 'E/TokenRequestor: You have wrong OAuth2 related configurations. Detailed error: INVALID_AUDIENCE'

ios - IOS11 的第三方登录 - GIDSignInButton

javascript - 如何更新 Redux + React 中的嵌套对象属性?

javascript - React - 在渲染函数中从 var 调用处理程序

javascript - 动态更改变量名称

javascript - 如何根据点击获取对应对象的值

java - 无法使用 ValueEventListener 从 Firebase 检索数据

ios - 构建我的 .xworkspace iOS 时找不到 -lRealmReact 的库

javascript - 使用 FlowType 进行 native react : Exporting and importing js interfaces