Я создаю приложение реагирования с использованием firebase. Я создаю учетную запись пользователя с использованием аутентификации телефона firebase, но проблема заключается в том, что аутентификация телефона firebase запускается локально, но я развертываю 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;
// });
}