When is the firebase user persistence loaded? I have some APIs I need to hit using data stored in the Firebase persistence. These APIs run in the constructor of the page. As such it appears that firebase.currentuser is null until after these APIs are hit. This is causing issues with my backend code.
Is there a way to force angular firebase to load the current user sooner?
here is an example
constructor(public environmentService : EnvironmentService)
{
firebase.initializeApp(config, "Test");
this.getUser() //returns null here
}
getUser()
{
return firebase.app("Test").currentUser
}
laterAPIcall () //called about 1 second later after constructors finish
{
this.getUser() // returns the current user which is not null anymore
}
EDIT: I need some way to force firebase to load the current user during or before the constructor of services runs. Is this possible?