Update Phone Number in Firebase Authentication - React Native

I have a screen it's a settings screen and I have an input that's for update data,

so I want to update the signed phone number how can I achieve it? and how i get the credential?

here's my code i used react-native-firebase v6+

import auth from '@react-native-firebase/auth';

 const updateMobile = async () => {
    await auth().currentUser.updatePhoneNumber(credential =>

When i call this function i got this error

Attempt to invoke virtual method "boolean java.lang.String.equals(java.lang.Object)" on an null object referance


I read a Docs and I get the credential like this, But i have an error , I dont know who's bind -_-

Possible Unhandled Promise Rejection (id: 2): TypeError: Cannot read property 'bind' of undefined


When i delete await in const snapshot = auth() .verifyPhoneNumber(mobile) the error go away but i see a new error

Error: [auth/invalid-credential] The supplied auth credential is malformed, has expired or is not currently supported.

  const updateMobile = async () => {
    const snapshot = await auth()
      .on('state_changed', phoneAuthSnapshot => {
        console.log('Snapshot state: ', phoneAuthSnapshot.state);
    const credential = auth.PhoneAuthProvider.credential(
    console.log('credential', credential);
    await auth().currentUser.updatePhoneNumber(credential);



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.