Closed jek-bao-choo closed 3 years ago
Yes we need a detailed documentation for use AngularFire .
Agreed! We will be expanding our docs in a future release.
It would be good if AngularFire2 documentation could include detailed explanation on this
AngularFire2 has a af.auth.subscribe() to subscribe to the auth service. The question is how can i make the guard wait for the observable and then return either true or false?
From reddit.com/r/Angular2/comments/4trb3v/how_to_implement_guard_with_angularfire2/
Hi @davideast I can lend a hand if you need me. You could put together an application for this purpose. I'll use that application that you put together to enhance the existing markdown documentation. Hope this would be helpful.
Is there any progress in this front. I've tried same approach in my app, with similar auth-service of todo-angular2-firebase example, having auth-guard and unauth-guard. When I logout, canActivate
gets called always prior to auth object nulls. I've tried .take(1)
or .first()
...no luck.
Why .logout()
does not return promise anyways?
UPDATE:
In my Auth-service signout()
method I directly use firebase.auth().signOut().then(
... now, instead of FirebaseAuthState's .logout()
method since firebase.auth().signOut() returns a promise. I hope this doesn't break anything else.
Is there any progress on this ?
AngularFire vs AngularFireAuth , both returns the same result , so AngularFire will handle all opereation it seems
constructor(public auth$: AngularFireAuth, public navCtrl: NavController, public af: AngularFire) {
this.authState = auth$.getAuth();
auth$.subscribe((state: FirebaseAuthState) => {
this.authState = state;
console.log(state);
});
//af.auth.getAuth()
this.af.auth.subscribe(auth => {
console.log(auth)
});// user info is inside auth object
}
Closing as outdated, we've revamped all of our auth handling have guards, etc. now all fairly well documented.
How to manage AngularFire2 authentication state (emit observable of sign-in or logout status) and Angular2 (RC4 and above) route guard to work with angularfire2?
I asked a question in Stackoverflow. But I feel that a detailed documentation here would benefit AngularFire2 Community.