Firebase + Ionic3 Error: disallowed_useragent

There are a few more questions / answers on this section , but they have not used Firebase with Ionic. I just switched to the new Ionic View and right now, my application in the old Ionic View is working, while the new Ionic View gives me this known error:

403 Error is an error. Error: disallowed_useragent its user agent is not allowed to make an OAuth authorization request on Google as it is classified as a built-in user agent (also known as a web view). blah blah blah

In my code, I add 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 View. OAuth, , Firebase , .

Firebase auth iOS/Android Ionic?

+6
4

ionic cordova build android --minifycss --optimizejs --minifyjs

+1

, Ionic View ..

CLI

ionic cordova run android --prod --device

ionic cordova run ios --prod --device
0

, iOS. Android , --livereload, .

ios , user_agent.

, , , config.xml

<feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

: https://firebase.google.com/docs/auth/web/cordova, : https://ionicframework.com/docs/native/firebase-authentication

,

0

. , signInWithPopup signInWithPopup , signInWithRedirect.

disallowed_useragent, config.xml:

<preference name="OverrideUserAgent" value="Mozilla/5.0 Google" />
0

Source: https://habr.com/ru/post/1689118/


All Articles