ashinga48 / React-Native-Firebase-Phone-Authentication

Seems there's not a proper react native plugin with phone authentication alone. So creating it.
9 stars 6 forks source link

Is this codebase is active ? Can you review the code ? #14

Open cullsin opened 5 years ago

cullsin commented 5 years ago

Hi,

Thanks for the app. Can you suggest me whether the code is working fine? Also, can you suggest the params that I am passing for the config are latest? I am getting an error in initialize.

  componentDidMount() {

const initsuccess = (response) => { 
    alert(JSON.stringify(response));
}

const initfail = ( response ) => { 
    alert(JSON.stringify(response));
}

RNFirebasePhoneAuth.initFirebase(config.project_id, 
        config.client[0].client_info.mobilesdk_app_id,
        config.client[0].api_key[0].current_key,
        config.firebase_url,
        initsuccess, 
        initfail
        );

const callBackSuccess = (response) => { 
    alert(JSON.stringify(response));
}

const callBackFailure = (response) => { 
    alert(JSON.stringify(response));
}

let phoneNumber = "+91988600000";
RNFirebasePhoneAuth.sendOTP(phoneNumber, callBackSuccess, callBackFailure);
 }

I am getting the below errror,

image

ashinga48 commented 5 years ago

Hey @cullsin, I am super busy with work. So couldn't maintain this repo anymore.

But I see you are not waiting for firebase to init. May be try this


const callBackSuccess = (response) => { 
    alert(JSON.stringify(response));
}

const callBackFailure = (response) => { 
    alert(JSON.stringify(response));
}

const initsuccess = (response) => { 
    alert(JSON.stringify(response));

    let phoneNumber = "+91988600000";
    RNFirebasePhoneAuth.sendOTP(phoneNumber, callBackSuccess, callBackFailure);

}

const initfail = ( response ) => { 
    alert(JSON.stringify(response));
}

componentDidMount() {

        RNFirebasePhoneAuth.initFirebase(config.project_id, 
        config.client[0].client_info.mobilesdk_app_id,
        config.client[0].api_key[0].current_key,
        config.firebase_url,
        initsuccess, 
        initfail
        );

 }