Flutter Flatter firebase重新验证未工作的用户

Flutter Flatter firebase重新验证未工作的用户,flutter,firebase-authentication,Flutter,Firebase Authentication,我正在从事一个基于firebase身份验证(电子邮件/密码)的项目。 我需要添加更改密码选项。尝试更改凭据时显示错误 错误“密码无效或用户没有密码。” 我已经用这个代码试过了 FirebaseAuth auth = FirebaseAuth.instance; checkUser() { if (auth.currentUser != null) { print(auth.currentUser.email); changePass(); } e

我正在从事一个基于firebase身份验证(电子邮件/密码)的项目。 我需要添加更改密码选项。尝试更改凭据时显示错误

错误“密码无效或用户没有密码。”

我已经用这个代码试过了

  FirebaseAuth auth = FirebaseAuth.instance;

  checkUser() {
    if (auth.currentUser != null) {
      print(auth.currentUser.email);
      changePass();
    } else {
      print("user not found");
    }
  }

  void changePass() async {
    print("clicked");
    EmailAuthCredential credential =
        EmailAuthProvider.credential(email: auth.currentUser.email, password: "Password@3221");

    await auth.currentUser.reauthenticateWithCredential(credential);
  }

使用此选项重置密码:

未来重置密码(字符串电子邮件)

异步的

{

等待授权发送密码重置电子邮件(电子邮件:email)


}

谢谢您的回复。。。但我想更改(更新)现有密码。我从官方文档中找到了使用凭据(凭据)重新身份验证,但不起作用。请检查我编辑的新答案编辑重置密码及其工作情况。你能检查一下这个吗。我想更改应用程序的密码。用户输入密码并确认密码,然后点击“更改密码”按钮。是的,这也很好。你能分享你的密码吗?用于更新密码(不重置)