Firebase Auth working in web but not on Android

I created an app with a Firebase backend, using also Firebase for the auth. When testing with simple ionic --serve everything is working fine. So today I started testing on Android, but I can get pass the authentication.

When checking the console (and placing some debug notes) I noticed that the use gets logged in, I get an UID back from Firebase, the user is sent to the home screen but immediately the logout action and ngOnDestory action is triggered.

I am new to app developing and Ionic framework, so I must have overlooked something simple here. Any thoughts where to start?

Not an issue I’m familiar with. Post code?

Looking up the piece of code to post I noticed this;

 if (!global.user.uid) {
      this.authProvider.logoutUser().then(() => {
        this.navCtrl.setRoot(LoginPage);
      });
    }

And somewhere down the line I removed setting the global.user.uid after the login…

To check if a user is logged in or not you can try this in your app.component.ts

rootPage: any;

const unsubscribe = firebase.auth().onAuthStateChanged((user) => {
  if (!user) {
    this.rootPage = 'login';
    unsubscribe();
  } else {
    this.rootPage = HomePage;
    unsubscribe();
  }
});