0

我一直使用Ionic 3.1.1Cordova Facebook PluginAngularFire2登錄到Firebase。它已經運行了好幾個月了,現在停止了工作。 (我不知道如果是從Ionic 2與離子3.1.1升級的結果)Ionic/Cordova Facebook登錄已停止工作

這裏是我的代碼:

login.ts

loginFacebookCordova(): Promise<FirebaseAuthState> { 
    return new Promise<FirebaseAuthState>((resolve) => { 
     Facebook.login(['public_profile', 'email']).then(facebookData => { 
      let cred: firebase.auth.AuthCredential = firebase.auth.FacebookAuthProvider.credential(facebookData.authResponse.accessToken); 
      firebase.auth().signInWithCredential(cred).then((data: FirebaseAuthState) => { 
       resolve(data); 
      }); 
     }, error => { 
      this.loading.dismiss(); 
      console.error('loginFacebook: ' + error); 
      this.doAlert('loginFacebook: ' + error.message); 
     }); 
    }); 
} 

loginFacebookBrowser(): Promise<FirebaseAuthState> { 
    return new Promise<FirebaseAuthState>((resolve) => { 
     this.af.auth.login({ provider: AuthProviders.Facebook, method: AuthMethods.Popup }).then((data: FirebaseAuthState) => { 
      resolve(data); 
     }).catch((error) => { 
      this.loading.dismiss(); 
      console.error('loginFacebook', error); 
      this.doAlert('loginFacebook: ' + error.message); 
     }); 
    }); 
} 

config.xml中

<plugin name="cordova-plugin-facebook4" spec="~1.7.4"> 
    <variable name="APP_ID" value="XXXXXXXXXXX" /> 
    <variable name="APP_NAME" value="theWhoZoo" /> 
</plugin> 

1.瀏覽器

如果我嘗試用瀏覽器(非科爾多瓦)登錄,我在控制檯中以下警告:

auth.js:101 firebase.auth.AuthCredential.provider is deprecated. Please use the providerId field instead.

然後我得到一個確認郵件,我確認像往常一樣,然後嘗試登錄它失敗,出現以下錯誤消息:

core.es5.js:1084 ERROR Error: Uncaught (in promise): Error: Loading chunk 4 failed. Error: Loading chunk 4 failed.

2. Android的設計

當我噸在Android設備(科爾多瓦插件)RY登錄,我得到如下:

Invalid key has: The key has xXXXXXXXXXXX= does not match any stored hashes. Configure your app key hashes at https://developers.facebook.com/apps/XXXXXXXXXXX/

當我看基本設置在developers.facebook.com,我APP ID變量APP_ID我​​3210匹配。

我使用:

"angularfire2": "^2.0.0-beta.8", 
"firebase": "^3.7.5", 

我已經通過文件一看,我無法找到發生了什麼變化或可能是什麼影響了這個Facebook登錄。如果有人能夠協助,我將不勝感激。

我需要瀏覽器和科爾多瓦登錄幫助。

感謝

回答

0

的問題是在我的developers.facebook.com Key Hash是不正確的。這解決了Android登錄和瀏覽器登錄問題(不知道爲什麼?)。

developers.facebook.com -> Settings -> Basic - Android -> Key Hashes.