Why am I not getting a password reset email from the Firebase service?

Viewed 403

I am trying to implement a password reset function that incorporates a SnackBar to display either success or error messages. The code shown below produces both the success message and the various error messages, as appropriate - but I never receive the password reset email from the Firebase service. I'm not sure if it's a Firebase setup issue or an issue with the code.

Future resetPassword() async {
    try {
      await FirebaseAuth.instance
          .sendPasswordResetEmail(email: _emailController.text.trim());
      _showSnackBar('Password reset link sent');
    } on FirebaseAuthException catch (e) {
      _showSnackBar(e.message.toString());
      return;
    }
  }

  Future<void> _showSnackBar(String msg) async {
    final snackBar = SnackBar(
      content: Text(msg),
    );
    ScaffoldMessenger.of(context).showSnackBar(snackBar);
  }
2 Answers

Disregard. Code seems to work fine - problem was either with Firebase Auth service or my internet service provider last night. All good now.

Make sure to check your spam, because if did not add authorize rules in firebase then the reset link goes in spam mail. .

Related