Muhammad Yousuf
Muhammad Yousuf

Reputation: 23

Firebase Phone Authentication Not Working after deploy

I create react app using firebase I create user account using firebase phone authentication but problem is that firebase phone authentication locallay run but i deploy app firebase so my phone authentication functionallity not working in react Here is code ..

var phoneNumber = th.state.Phone;
            var appVerifier = window.recaptchaVerifier;
            firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)
              .then(function (confirmationResult) {
                window.confirmationResult = confirmationResult;
                // conform = confirmationResult;
                console.log('result', confirmationResult);
              })
              .then(() => {
                th.setState({ status: 'hide', modalOpen: true })
              }).catch(function (error) {
                // Error; SMS not sent
                th.setState({ status: 'hide' })
                console.log('err',error);
                // ...
              })
componentDidMount() {
    window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in', {
      'size': 'invisible',
      'callback': function (response) {
        // reCAPTCHA solved, allow signInWithPhoneNumber.
        //    this.onSignInSubmit();
        console.log('res', response)
      }
    });
    //  window.recaptchaVerifier.render().then(function (widgetId) {
    //    window.recaptchaWidgetId = widgetId;
    //    });
  }

Upvotes: 0

Views: 827

Answers (2)

Tuan
Tuan

Reputation: 36

You need to add your link web after deploy to your firebase project. It's work for me. https://i.sstatic.net/6YOHp.png

Upvotes: 2

Muhammad Yousuf
Muhammad Yousuf

Reputation: 23

Problem is that firebase does not find otp because i deploy react app another firebase project so if you are using firebase otp so deployment on same project

Upvotes: 0

Related Questions