I am signing in to my app using Google like this:
signInWithGoogle() {
return this.afAuth.auth.signInWithRedirect(new auth.GoogleAuthProvider());
}
Then I am subscribing to the user observable and redirect if the user is signed in:
this.sub = this.auth.user$.subscribe((user) => {
if (user) {
this.router.navigate(['/']);
}
});
It work perfectly fine. However, it is extremely slow. It takes at least 5 seconds before the user is redirected to the index page.
Less time between sign in and redirecting user.
Hi @sondresorbye0111! This repo is a wrapper around auth please raise your issue with the official SDK if it still persists. Auth is a time consuming process so it can take 5 seconds on slow connections.
@davideast, this problem does not occur in vanilla js. The problem is that the user observable emits the user object very late even after the user has been redirected back from Google login page.
What version are you on for Angular, AngularFire, RxJS, and Firebase JS? This may be a zones issue.
"@angular/core": "^6.0.5",
"angularfire2": "^5.0.0-rc.10",
"rxjs": "^6.2.1",
"firebase": "^5.0.4"
I've had the same issues. Using latest everything. There is a significant delay in the observable.
Can someone create a stackblitz the shows the problem? I haven't ran into it myself
Can you use my open-source project? https://github.com/MAGSON-dev/scrumboard
Why don't you read the official angularfire2 documentation about authentication: https://github.com/angular/angularfire2/blob/master/docs/auth/getting-started.md
@patrickmichalina Can you provide a code sample or some context to help troubleshoot? I've been testing and haven't hit this problem.
Just an idea, guys. You might want to upgrade your RXJS, rxjs-compat(if using), and also angularfire2 for better compatibility.
This is still an ongoing issue and I believe the problem is with Firebase SDK itself. Im surprised this has not yet been solved.
I'm still getting this problem myself and have had a few users comment on its slowness.
It has slow Google authentication because it needs to contact FIrebase's server to retrieve your secret access key, then use that key to authenticate to Google's authentication server. Then, on your browser, it puts out a success or a error response,
Outdated. Not a reproducible AF issue.
Most helpful comment
It has slow Google authentication because it needs to contact FIrebase's server to retrieve your secret access key, then use that key to authenticate to Google's authentication server. Then, on your browser, it puts out a success or a error response,