当我尝试输入未注册的凭据时,它返回“无效凭据”错误而不是“用户未找到”。
try {
final userCredential = await FirebaseAuth.instance
.signInWithEmailAndPassword(
email: email,
password: password,
);
print(userCredential);
} on FirebaseAuthException catch (e) {
print("FirebaseAuthException: $e");
print("Complete exception details: ${e.toString()}");
if (e.code == 'user-not-found') {
print('User not found');
} else {
// Handle other specific error cases if needed
}
}
Firebase 可以选择提供防止电子邮件枚举附加,并且您的项目似乎已启用该功能。启用该保护后(自 9 月 15 日起创建的项目默认启用该保护),API 将返回不同的响应,以免泄露用户信息。
您可以禁用保护,或修改您的应用程序以不再依赖于已修改的流程。
另请参阅: