为什么我的 Firebase 身份验证错误代码是“无效身份验证”而不是“用户未找到”? [重复]

问题描述 投票:0回答:1

当我尝试输入未注册的凭据时,它返回“无效凭据”错误而不是“用户未找到”。

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
    }
  }

flutter firebase-authentication
1个回答
2
投票

Firebase 可以选择提供防止电子邮件枚举附加,并且您的项目似乎已启用该功能。启用该保护后(自 9 月 15 日起创建的项目默认启用该保护),API 将返回不同的响应,以免泄露用户信息。

您可以禁用保护,或修改您的应用程序以不再依赖于已修改的流程。

另请参阅:

© www.soinside.com 2019 - 2024. All rights reserved.