问题描述
我在我的应用程序中使用 Firebase Auth 我正在检测用户是否从今天开始使用 ùserChanges` 登录,没有问题,但是当我向我的应用程序添加电话验证并在另一个页面上监听她的更改时,此警告向我的控制台发送垃圾邮件,并且应用程序无法正常工作。 (例如,当我点击发送验证邮件按钮时,它会在 4-5 秒后发送邮件,对于电话身份验证,甚至可能在 1 分钟后出现重新验证码,而代码在 1 次联合(大约)后出现)。
代码:
void checkSignIn() {
firebaseAuth.idTokenChanges().skip(1).listen((event) async {
if (event != null) {
var data = await DataBaseManager.userDataDBRef
.child("users")
.child("${firebaseAuth.currentUser.uid}/phoneVerified")
.once();
bool emailVerified = firebaseAuth.currentUser.emailVerified;
var pv = data.value;
bool phoneVerified = false;
if (pv == null) {
phoneVerified = false;
} else {
phoneVerified = pv;
}
setState(() {
signedIn = true;
verificationrequired = !(phoneVerified && emailVerified);
});
} else {
setState(() {
signedIn = false;
verificationrequired = false;
});
}
});
}
如果 verificationrequired
为 true,我会将用户发送到电话和电子邮件验证页面
Future checkVerifications() async {
firebaseAuth.userChanges().skip(1).listen((event) async {
if (event != null) {
var data = await DataBaseManager.userDataDBRef
.child("users")
.child("${firebaseAuth.currentUser.uid}/phoneVerified")
.once();
setState(() {
emailVerified = firebaseAuth.currentUser.emailVerified;
var pv = data.value;
if (pv == null) {
phoneVerified = false;
} else {
phoneVerified = pv;
}
});
} else {}
});
}
控制台:
W/System (25415): Ignoring header X-Firebase-Locale because its value was null. 2 I/System.out(25415): (HTTPLog)-Static: isSBSettingEnabled false W/System (25415): Ignoring header X-Firebase-Locale because its value was null. 2 I/System.out(25415): (HTTPLog)-Static: isSBSettingEnabled false W/System (25415): Ignoring header X-Firebase-Locale because its value was null. 2 I/System.out(25415): (HTTPLog)-Static: isSBSettingEnabled false W/System (25415): Ignoring header X-Firebase-Locale because its value was null. 2 I/System.out(25415): (HTTPLog)-Static: isSBSettingEnabled false
即使我第一次按下发送代码按钮,我也收到了来自 Firebase Auth 的 too-many-request
错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)