I'm trying to implement Firebase Authentication and sending received user's data to the server for creating account in my app.
Here is the code:
ngAfterViewInit(): void {
const provider = new firebase.auth.GoogleAuthProvider();
fromEvent(this.LoginWithGoogle.nativeElement, 'click')
.pipe(
exhaustMap(() =>
from(this.afAuth.signInWithPopup(provider)).pipe(
map((data) => data.user),
concatMap((user) =>
this.authService.loginWithGoogle({
email: user.email,
username: user.displayName,
})
)
)
)
)
.subscribe((res) => {
console.log(res);
});
}
It works well. But is it right to use nested RxJs operators like this? And there is any alternative solution for this case?