@angular/fire login with google provider not working

31 views
Skip to first unread message

Irnel Victoria

unread,
Jan 6, 2020, 12:41:21 PM1/6/20
to Angular and AngularJS discussion

I am using @angular/fire 5.2.2 when a trying to login with google provider, into credential (param email is null).

Some time ago I was working perfectly.
But upgrade from angular 6 to 8.
Maybe there could be some kind of problem in the update.

this is my code.


AuthLogin(provider) {
   return this.afAuth.auth.signInWithPopup(provider)
     .then(credential => {

        const user: User = {
         displayName: credential.user.displayName,
         email: credential.user.email,
         phoneNumber: credential.user.phoneNumber,
         photoURL: credential.user.photoURL,
         publish: false,
         roles: [Roles.Provider],
         emailVerified: true,
         refreshToken: credential.user.refreshToken,
         parentId: null,
         uid: credential.user.uid
       };

        this.SetUserData(user);
       this.currentUserSubject.next(user);
     });
 }



// Sign in with Google
 GoogleAuth() {
   const provider = new auth.GoogleAuthProvider();
   provider.addScope('profile');
   provider.addScope('email');

    return this.AuthLogin(new auth.GoogleAuthProvider());
 }


Reply all
Reply to author
Forward
0 new messages