Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong af.auth.getAuth() #248

Closed
doczoidberg opened this issue Jun 20, 2016 · 4 comments
Closed

wrong af.auth.getAuth() #248

doczoidberg opened this issue Jun 20, 2016 · 4 comments
Milestone

Comments

@doczoidberg
Copy link

doczoidberg commented Jun 20, 2016

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 #231

@jeffbcross
Copy link
Contributor

Is uid null, or is the result of af.auth.getAuth() null? If the latter, then sounds like the same issue as #251

@jeffbcross jeffbcross added this to the beta.2 milestone Jun 20, 2016
jeffbcross added a commit to jeffbcross/angularfire2 that referenced this issue Jun 21, 2016
@jeffbcross
Copy link
Contributor

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?

@doczoidberg
Copy link
Author

doczoidberg commented Jun 21, 2016

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?

@jeffbcross
Copy link
Contributor

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.

jeffbcross added a commit to jeffbcross/angularfire2 that referenced this issue Jun 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants