简体   繁体   English

部署后Firebase电话身份验证不起作用

[英]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 .. 我使用firebase创建反应应用程序我使用firebase手机身份验证创建用户帐户但问题是firebase手机身份验证locallay运行但我部署了应用程序firebase所以我的手机身份验证功能无法工作反应这里是代码..

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;
    //    });
  }

问题是firebase没有找到otp,因为我部署了反应app另一个firebase项目所以如果你使用firebase otp那么部署在同一个项目上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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