angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.69k stars 2.19k forks source link

Angular 10 signInWithRedirect bug #2585

Closed ngaffa closed 3 years ago

ngaffa commented 4 years ago

Version info

**Angular: 10

**Firebase: ^7.16.0

**AngularFire: ^6.0.2

**Other (e.g. Ionic/Cordova, Node, browser, operating system): Angular web app

How to reproduce these conditions

When the auth is succeeded and get redirected to the angular code all request to the cloud firestore doesn't work

I have a method that work fine in Angular 8 : when the user is authentified by (google,Microsoft or Facebook) i get the information and i pushed it to the databse (cloud firestore)

Steps to set up and reproduce

constructor(private afAuth: AngularFireAuth, private afs: AngularFirestore)

this.afAuth.getRedirectResult().
.then( async (result) => { console.log(result); if (result.credential) { // all this code to save user info in firestore does'nt work any more await this.afs.doc(users/${result.user.uid}) .set( { email: result.user.email, emailVerified: true, fullname: result.user.displayName }, { merge: true } ); } }
);

So this method does'nt work any more, when i upgrade to Angular 10 But, when i do that : -->I import * as firebase from 'firebase'; -->I replace this.afAuth.getRedirectResult() by firebase.auth().getRedirectResult() Then all it works like expected

or when i use signinwithpopu inside, all it works, I think you have a problem with ngZone

Sample data and security rules

Debug output

Nothing happens

Expected behavior

It should push the return data of the authentication to the firestore in the promise of the getredirectResult without problem

Actual behavior

nothing happen When i pushed the return data of the authentication to the firestore in the promise of the getredirectResult , i have no error, no success, like the function, doesn't exist

jamesdaniels commented 4 years ago

I'll look into this, in the meantime please check out 6.0.3 and try observing just .authState or .user from AngularFireAuth, as we're now waiting for redirect result.

jamesdaniels commented 3 years ago

Seems to be fixed now. Closing.

ngaffa commented 3 years ago

yeees good job !! :)