【发布时间】:2021-04-07 10:40:03
【问题描述】:
我正在尝试使用 Firebase 在本机应用程序中设置 OTP 验证。 我遵循了 firebase docs phone auth 中给出的所有步骤。 根据代码 otp 成功发送但未验证。 如果我使用另一个设备电话号码,则验证代码,但如果我使用安装了应用程序的相同电话号码(该电话号码的应用程序和 sim 卡都在同一设备中),那么它会给出无效代码的响应
async function confirmCode() {
try {
let confirmation = await props.route.params.confirmation;
await confirmation.confirm(verifyCode);
alert("Successfully Verified!!")
props.navigation.navigate('home')
} catch (error) {
console.log('Invalid code.');
}
}
return (
<View style={styles.body}>
<TextInput style={styles.textInput} placeholder="Verification Number" keyboardType="phone-pad"
onChangeText={(text) => { setVerifyCode(text) }} />
<TouchableOpacity onPress={() => { confirmCode() }} style={styles.button}>
<Text style={{ color: 'white', alignSelf: 'center', fontSize: 19, fontWeight: 'bold' }}>Verify Code</Text>
</TouchableOpacity>
</View>
)
}
【问题讨论】:
标签: android firebase react-native firebase-authentication