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