问题描述
关于此主题<,但是他们没有将Firebase与Ionic一起使用.我刚刚切换到新的Ionic View,现在,在旧的Ionic View中,我的应用程序正常工作,而新的Ionic View给了我这个众所周知的错误:
There are a couple of other questions/answers on this topic, but they were not using Firebase with Ionic. I just switched to the new Ionic View and right now today, my app in the old Ionic View works while the new Ionic View gives me this well known error:
在我的代码中,我注入了Firebase AuthProvider并使用angularfire2进行连接,看起来像
In my code I inject the Firebase AuthProvider and use angularfire2 to connect and it looks like
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))
. . .
同样,这在浏览器或旧的Ionic中效果很好,但不适用于新的Ionic View.我确实有一个很大的具有常规OAuth连接的库,但是我认为使用Firebase的重要原因之一是我们将不再需要使用这些库并自行管理用户.
Again, this works great in the browser or old Ionic but not the new Ionic View. I do have a fairly big library with general OAuth connections, but I thought that one of the great reasons to use Firebase is that we would no longer have to use those libraries and manage users ourselves.
是否可以通过Ionic在iOS/Android应用上进行Firebase身份验证?
Is there a way to do the Firebase auth on an iOS/Android app via Ionic?
推荐答案
您应遵循本文.我认为不支持signInWithPopup
方法,您应该尝试使用signInWithRedirect
.
You should follow the instructions in this article. I don't think signInWithPopup
method is supported, you should try signInWithRedirect
instead.
我通过在config.xml
中添加以下内容来解决了disallowed_useragent
错误:
I managed to fix the disallowed_useragent
error by adding the following to my config.xml
:
<preference name="OverrideUserAgent" value="Mozilla/5.0 Google" />
这篇关于Firebase + Ionic3错误:disallowed_useragent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!