【问题标题】:Unable to get image from Google User profile无法从 Google 用户个人资料中获取图片
【发布时间】:2022-08-06 03:10:39
【问题描述】:

在我的反应网络应用程序中,有时它不会从用户配置文件中加载图像。我正在使用反应。 它通常有效,但有时无效。

这是浏览器显示的错误:

Failed to load resource: the server responded with a status of 403 ()

这是我的代码:

async function singIngWithGoogle(){
    const provider = new firebase.auth.GoogleAuthProvider();
        
    const loginResult = await auth.signInWithPopup(provider);
      
        if(loginResult.user){
          const { displayName, photoURL, uid, email } = loginResult.user;
          
          if( !displayName || !photoURL ){
            throw new Error(\'Seu usuário Google não possui nome ou foto.\');
          }

          setUser({
            id: uid,
            name: displayName,
            avatar: photoURL ?? {noUserImg},
            userEmail: email ?? \'\'
          })

        }
  }

    标签: reactjs typescript


    【解决方案1】:

    在 react js 的图像标签中使用此属性。 referrerpolicy="无推荐人"

    【讨论】:

      猜你喜欢
      • 2018-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 1970-01-01
      • 2016-04-08
      相关资源
      最近更新 更多