Home > Mobile >  ionic login with facebook using firebase
ionic login with facebook using firebase

Time:11-25

i used to have a working code but recently it is broken with auth() not recognized etc.

current broken code is:

import { Facebook } from '@ionic-native/facebook/ngx'
import { AngularFireAuth } from '@angular/fire/compat/auth';
import * as firebase from 'firebase/app';

constructor(
    private afAuth: AngularFireAuth,
    public fb:Facebook,
  )

login(){
    if (this.platform.is('cordova')) {
      return this.fb.login(['email', 'public_profile']).then(res => {
        const facebookCredential = firebase.auth().FacebookAuthProvider.credential(res.authResponse.accessToken);
         firebase.auth.signInWithCredential(facebookCredential);
      }).catch(err)
    }

in the above code auth() is not recognized

CodePudding user response:

Did you upgrade to v9 of the Firebase JavaScript SDKs by any chance or to version 7 of AngularFire?

If so, see the AngularFire v7 upgrade guide and the Firebase JS v9 upgrade guide.

  • Related