关于此主题还有其他几个问题/答案,但他们没有将Firebase与Ionic一起使用.我刚刚切换到新的Ionic View,现在,我的应用程序在旧的Ionic View中工作,而新的Ionic View给出了这个众所周知的错误:
403错误 - 这是一个错误.错误:disallowed_useragent不允许其用户代理向Google发出OAuth授权请求,因为它被归类为嵌入式用户代理(也称为Web视图).等等等等等等
在我的代码中,我注入Firebase 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))
. . .
Run Code Online (Sandbox Code Playgroud)
再次,这在浏览器或旧的Ionic中很有用,但不适用于新的Ionic View.我确实有一个相当大的库与一般OAuth连接,但我认为使用Firebase的一个重要原因是我们不再需要使用这些库并自己管理用户.
有没有办法通过Ionic在iOS/Android应用上进行Firebase身份验证?
firebase firebase-authentication angularfire2 ionic3 angular