Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Firebase Auth Password Reset

I'm trying to utilize the Firebase Auth sendPasswordResetEmail() call in my app.

In my auth file I declare the following:

 Future<void> sendPasswordResetEmail(String email) async {
    return _firebaseAuth.sendPasswordResetEmail(email: email);
  }

I pass the Auth to my a form widget that takes in this password and has the following onPressed function once I submit.

onPressed: () async {
    var response = await checkEmail();
    setState(() {
        this._emailValidator = response;
    });
    if (_formKey.currentState.validate()) {
        _formKey.currentState.save();
        try {
            await widget.auth
                .sendPasswordResetEmail(_email);
        } catch (e) {
            print(e);
        }
    }

},

I get the following console message after running it with a proper email:

"Tried calling: sendPasswordResetEmail("[email protected]")" Note: I used a real email for this.

I've set up the Firebase email template system but have not received any email. Does anyone know how I can further troubleshoot this or why my email is not working?

Thanks!

like image 765
PJQuakJag Avatar asked Dec 13 '18 16:12

PJQuakJag


People also ask

How do I verify my email on flutter firebase?

Enable Email Link sign-in for your Firebase project. To sign in users by email link, you must first enable the Email provider and Email link sign-in method for your Firebase project: In the Firebase console, open the Auth section. On the Sign in method tab, enable the Email/Password provider.


1 Answers

I figured this out. I was not correctly passing the auth down from my auth file to the new file. As such, the method was being called on null, resulting in NoSuchMethodError.

like image 189
PJQuakJag Avatar answered Oct 22 '22 01:10

PJQuakJag