4

this topic還有一些其他問題/答案,但他們沒有使用Firebase和Ionic。我今天剛切換到新的離子觀而現在,我在老離子查看應用程序的工作原理,而新的離子觀給了我這個衆所周知的錯誤:Firebase + Ionic3錯誤:disallowed_useragent

403 Error - Thats an error. Error: disallowed_useragent his user-agent is not permitted to make an OAuth authorization request to Google as it is classified as an embedded user-agent (also known as a web-view). blah blah blah

在我的代碼注入火力地堡AuthProvider和使用angularfire2連接,它看起來像

private getProvider(from: string): AuthProvider { 
    switch (from) { 
    case 'twitter': return new firebase.auth.TwitterAuthProvider(); 
    case 'facebook': return new firebase.auth.FacebookAuthProvider(); 
    case 'github': return new firebase.auth.GithubAuthProvider(); 
    case 'google': return new firebase.auth.GoogleAuthProvider(); 
    } 
} 

    signIn(from: string) { 
    this.afAuth.auth.signInWithPopup(this.getProvider(from)) 
. . . 

同樣,這部作品在瀏覽器或舊離子,但不是新的離子觀大。我的確擁有一個擁有一般OAuth連接的相當大的圖書館,但我認爲使用Firebase的一個重要原因是我們不再需要自己使用這些圖書館和管理用戶。

有沒有辦法通過Ionic在iOS/Android應用上進行Firebase身份驗證?

+0

你可以在真實設備上測試嗎? – Sampath

+0

不,我還沒有準備好將它變成一個獨立的應用程序 - 我只使用離子視圖到目前爲止,但也許我會嘗試。 – John

回答

0

我強烈建議你自視離子應用程序中的真實設備上運行這個有很多與本地插件問題等

CLI

ionic cordova run android --prod --device 

ionic cordova run ios --prod --device