简体   繁体   中英

ionic login with facebook using firebase

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM