Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase React Native googleUser.getBasicProfile不是函数_Firebase_React Native_Google Authentication - Fatal编程技术网

Firebase React Native googleUser.getBasicProfile不是函数

Firebase React Native googleUser.getBasicProfile不是函数,firebase,react-native,google-authentication,Firebase,React Native,Google Authentication,每当我运行代码时,谷歌窗口就会弹出,我可以选择帐户。选择帐户后,我将显示此错误: “googleUser.getBasicProfile不是函数。” 这是我的密码: isUserEqual=(googleUser, firebaseUser) =>{ if (firebaseUser) { var providerData = firebaseUser.providerData; for (var i = 0; i <

每当我运行代码时,谷歌窗口就会弹出,我可以选择帐户。选择帐户后,我将显示此错误: “googleUser.getBasicProfile不是函数。”

这是我的密码:

    isUserEqual=(googleUser, firebaseUser) =>{
        if (firebaseUser) {
          var providerData = firebaseUser.providerData;
          for (var i = 0; i < providerData.length; i++) {
            if (providerData[i].providerId === firebase.auth.GoogleAuthProvider.PROVIDER_ID &&
                providerData[i].uid === googleUser.getBasicProfile().getId()) {
              // We don't need to reauth the Firebase connection.

              return true; 
            }
          }
        }
        return false;
      }
isUserEqual=(谷歌用户、firebaseUser)=>{
if(firebaseUser){
var providerData=firebaseUser.providerData;
对于(变量i=0;i
在中,我们可以看到函数
Google.logInAsync
的返回对象是您方法的
googleUser
(我想,因为我在中对该函数有相同的问题),并且注意,在logInAsync的返回中没有任何方法与他匹配。 因此,我将
providerData[i].uid
googleUser.user.id
匹配

这是重写的代码:

for (var i = 0; i < providerData.length; i++) {
   if (providerData[i].providerId === firebase.auth.GoogleAuthProvider.PROVIDER_ID &&
      providerData[i].uid === googleUser.user.id) {
      return true;
   }
 }
for(变量i=0;i
当您输入方法时,googleUser的值是多少?在返回对象“googleUser”中没有方法。您解决了吗?