[英]Recaptcha verification failed - DUPE - firebase phone verification react
所以基本上在用户注册我的 web 应用程序的帐户后,我想使用他们输入的数字向用户发送文本。 但我不断收到这个错误。
Recaptcha verification failed - DUPE
另外,在我的窗口控制台中,我收到一个错误“未捕获的语法错误:意外令牌:字符串文字”我应该注意我正在使用不可见的 Recaptcha,并且我已在 firebase 中为 email 和电话身份验证设置了所有内容
export default class PhoneNumberVerificationPage extends Component {
constructor(props){
super(props);
this.state={
phone: '',
isLoading: false
}
}
onChangeHandler = (phone) =>{
this.setState({
phone
})
}
onVerifyPhoneNumber = async () =>{
const {phone} = this.state;
let phoneNumber = "+" + phone;
var appVerifier = new f.auth.RecaptchaVerifier('button', {
'size': 'invisible'
});
return auth.currentUser.linkWithPhoneNumber(phoneNumber, appVerifier)
.then( (confirmationResult) => {
var code = window.prompt('Provide put in the your SMS code');
return confirmationResult.confirm(code);
})
.then(async () =>{
await firestore.doc(`/user/${auth.currentUser.uid}`).update({
nextRoute: `/user-info/${auth.currentUser.uid}/add`
})
this.props.history.push(`/user-info/${auth.currentUser.uid}/add`)
})
}
render() {
const {isLoading} = this.state
return (
<div className='phone-number-verification-page'>
{isLoading && <Loading/>}
<Modal title='Verify Phone Number' hideCloseButton>
<PhoneInput
country={'us'}
value={this.state.phone}
onChange={this.onChangeHandler}
/>
<button
onClick={this.onVerifyPhoneNumber}
id='button'
className='button--submit u-margin-medium'>Submit</button>
</Modal>
</div>
)
}
}
错误消息中的 DUPE 是 DUPLICATE 的缩写。 我怀疑你不应该每次都创建一个新的RecaptchaVerifier object 而是重用一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.