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:
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
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))
. . .
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.
Is there a way to do the Firebase auth on an iOS/Android app via Ionic?
You should follow the instructions in this article. I don't think signInWithPopup
method is supported, you should try signInWithRedirect
instead.
I managed to fix the disallowed_useragent
error by adding the following to my config.xml
:
<preference name="OverrideUserAgent" value="Mozilla/5.0 Google" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With