Home > Back-end >  Phoneauthprovider is not a function firebase react-native
Phoneauthprovider is not a function firebase react-native

Time:09-26

Hi everybody im making a app using react-native and fire base im have this initial config at firebase config :

import firebase from 'firebase/app';
import 'firebase/auth';
import Constants from 'expo-constants';
// Firebase Config
// Initialize Firebase
export const firebaseConfig = {
  apiKey: Constants?.manifest?.extra?.apiKey,
  authDomain: Constants?.manifest?.extra?.authDomain,
  projectId: Constants?.manifest?.extra?.projectId,
  storageBucket: Constants?.manifest?.extra?.storageBucket,
  messagingSenderId: Constants?.manifest?.extra?.messagingSenderId,
  appId: Constants?.manifest?.extra?.appId
};

let Firebase

if (firebase.apps.length === 0) {
  console.log('hello world')
  Firebase = firebase.initializeApp(firebaseConfig);
}

export default Firebase;

And im triyng to call this method:

  const loginUser = async() => {
    switch(loginType){
      case 0:
      break;
      case 1:
        if (typeof(verificationId) == 'string') { 
          setLoading(true)
          try {
            const credential = new Firebase.auth.PhoneAuthProvider.credential(
              verificationId,
              verificationCode
            );
            await Firebase.auth.signInWithCredential(credential);
            showMessage({ text: 'Phone authentication successful            
  • Related