Angularfire: firebaseAuth.authState emits null 1 second after valid state from login was emitted

Created on 20 Apr 2018  路  3Comments  路  Source: angular/angularfire

Version info

"@angular/core": "^5.2.10",
"firebase": "^4.12.1",
"angularfire2": "^5.0.0-rc.5-next",
Node v8.9.4

only happens on my android 6.0.1 (yes, old phone)

How to reproduce these conditions

I check the authState in the AuthService with the Subscription on firebaseAuth.authState:

this.firebaseAuth.authState.subscribe(user => {
        this.authState = user;
    });

On Desktop and 1 other phone this works as it should.
On my Phone after the login authState emits the authState and 1 second later it emits null.
If i refresh the page on any desktop the authState is loaded again, but not on my Phone.

I know this is very hard, neary impossible to reproduce, but I have no idea what I should do to get rid of this bug. I don't want to store the state in the browser. What can be the reason that the authState emitts null one second after it has emitted a valid State?
it seems that firebase made a logout on my user. but why?

here is my code:
https://github.com/muehan/mue-shoplist/blob/master/src/app/services/auth.service.ts

Debug output

nothing at all...

Expected behavior

authState does not emit null before logout
refresh page does reload old authState

Actual behavior

authState emits null 1 second after sending valid state
refresh does not return old authState

Most helpful comment

I have fix it with
"firebase": "^4.13.0",

All 3 comments

"@angular/core": "5.0.3",
"angularfire2": "^5.0.0-rc.6",
"firebase": "^4.11.0",

Same here with Android 5.1.1. Just after successful login, it emits the first correct value, then all values are null

I had the same problem, temporarily I solved it installing the version 4.8.2 of firebase

"firebase": "^4.8.2"

I have fix it with
"firebase": "^4.13.0",

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isylhdin picture isylhdin  路  3Comments

sharomet picture sharomet  路  3Comments

DennisSmolek picture DennisSmolek  路  3Comments

StephenFluin picture StephenFluin  路  3Comments

avanderbergh picture avanderbergh  路  3Comments