如何解决Firebase中通过电话号码进行身份验证的问题?
某些手机会自动确认发送到短信的密码
在某些情况下,您必须手动编写
使其正常工作的最佳实践是什么?
async function signInWithPhoneNumber(phoneNumber) {
const confirmation = await auth().signInWithPhoneNumber(phoneNumber);
setConfirm(confirmation);
}
async function confirmCode(code) {
try {
await confirm.confirm(code).then((user) => {
// Logic when confirmed
})
} catch (error) {
console.log('Invalid code.');
}
}
当我输入正确的代码时,confirmCode函数中有一些逻辑