Hi,
I was playing around with the Auth service, and I discovered a weird behavior...
Most of the time, when trying to log in using any provider (see screenshot), I always receive two streams values:
null value!! (which means that the user is not logged in).
However, after refreshing the app (i.e. hitting F5), I get one event back with the right session info:

And, when logging out, the app receives a null value, which is the expected behavior ofc:

Here is a portion of my code:
this.af.auth.subscribe(
user => {
if(user) {
this.isAuth = true;
}
else {
this.isAuth = false;
}
},
error => {
console.trace(error);
}
);
Any idea?
After some trials. It seems that this behavior only happens when using the AuthMethods.Redirect method.
Can you throw up an example on plnkr so I can debug the heck out of it?
@davideast I'll set up a plnkr for you. In the mean time, the code lives here: https://github.com/manekinekko/angular2-firebase-authentication
And of course, the bootstrap configuration: https://github.com/manekinekko/angular2-firebase-authentication/blob/master/src/main.ts#L25
You just need to use the AuthMethods.Redirect method
@davideast here is the plnkr: https://plnkr.co/edit/qA6ebLo4ISfK5og28m71?p=preview (you need to open the app in live mode so the redirect can work).
I added a log output. As you can see, when login in using a redirect method, we have 2 entries in the output json logs array:

Sorry for the delay @manekinekko! Thank you for your hard work on this issue! We will get it fixed for the next release :)
@davideast, looks like this will solve #324 as well. Should we mark that one as duplicate as well, like #452?
I did for one of them, but yes it should be for both.
@davideast I just updated my app to angularfire2@next and the issue seems to be fixed 馃憦
Here is my commit: https://github.com/manekinekko/angular2-firebase-authentication/commit/64066bb66c3e67865a4f64d1560ddd59483a6a5a
(btw, I had to upgrade angular2 to RC5 too, hence all those changes)
@manekinekko What is your version of angularfire2 after the update?
@vkniazeu I was using angularfire2@next.
@manekinekko Just to be sure, do you have 2.0.0-beta.4?
I see this one as the latest. What does your npm list show after running angularfire2@next for angularfire2? Thanks!
Nope. I updated my code before beta4 ^^
It listed beta3.pre-2. See here https://github.com/manekinekko/angular2-firebase-authentication/commit/64066bb66c3e67865a4f64d1560ddd59483a6a5a#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R28
@davideast AuthMethods.Redirect is working for me now too after the update to 2.0.0-beta.4.
Thanks!
Most helpful comment
Sorry for the delay @manekinekko! Thank you for your hard work on this issue! We will get it fixed for the next release :)