When refreshing a page I don't get the logged in user in the constructor of my component:
af.auth.getAuth()) //null
could be the same issue as https://github.com/angular/angularfire2/issues/231
Is uid null, or is the result of af.auth.getAuth() null? If the latter, then sounds like the same issue as #251
Actually, there is currently no way to synchronously get a user object when the page loads. https://firebase.google.com/docs/auth/web/manage-users#get_the_currently_signed-in_user
I think the best strategy here is to deprecate getAuth, add a console.warn inside it for now to notify developers that when called when opening the app, the user may show as null.
@davideast thoughts?
shouldn't all async methods be named with async?
also a synced version would be great. Otherwise one have to inject the uid into all components.
Also how should I handle page refreshes?
shouldn't all async methods be named with async?
That's not a convention we use, particularly because the Observable or Promise return type implies async. And most APIs in this library are async, so sync would be the special case.
also a synced version would be great.
We're limited by the SDK, and us providing a getAuth method doesn't add any value over just injecting the FirebaseApp instance and accessing app.auth.currentUser. We want to keep the surface of this library as small and focused as possible, only providing APIs where we can add Angular-specific value.
Most helpful comment
shouldn't all async methods be named with async?
also a synced version would be great. Otherwise one have to inject the uid into all components.
Also how should I handle page refreshes?