Wednesday, 6 September 2017

Firebase Authentication Firebase Network Exception Error: A network error (such as timeout, interrupted connection or unreachable host) has occurred

This error occurs when I run my ionic/firebase code on my phone, but it works fine on my system.

After digging around a lot, I figured out that it is being caused by either of these two reasons

1. I need to add my plugins to the white list, so run this command:

cordova plugin add cordova-plugin-whitelist 

2. me not waiting for the

firebase.auth().onAuthStateChanged

 To return a user before trying to make a call to firebase servers. In my own case, I had erroneously set rootPage = LoginPage;  Instead of not setting it to anything like so rootPage: any;
At the top of the constructor of my firebase appComponent.ts

What it meant was that my login page was pulling up before my firebase got loaded. The resulting problem was that I would try to login before my firebase loaded, and the app will detect firebase as offline, therefore throw that error.


No comments:

Post a Comment