Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why did this code fail to send password reset link in firebase (Reactjs)?

I am new to firebase and I am trying to handle firebase user authentication in React.js. I did manage to create users with email and passwords. But, now I would like to send the user an Email link to reset their password. My code currently look like this.

// This line of code belongs to the top
import { auth } from '../firebaseConfig'

//This part goes under the React component
    <p onClick={async () => {
      try{
        await sendPasswordResetEmail(auth, // My Email Id)
        alert('Password reset link has been sent to your email')
      }
      catch(err){
        alert(err)
      }
    }}
    >Forgot your Password ?</p>

However, I do not get any error messages and I do get the alert message that says "Password reset link has been sent to your email." Unfortunately, I didn’t receive any email. Any help will be appreciated.
Note that I have given my own email id as the parameter for testing purposes.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Did you check your spam folder? We recently see a lot of the emails from Firebase Authentication ending up in the user’s spam folder.

To reduce the chances of this happening, consider taking more control of the email delivery yourself.

  1. As a first step, consider using a custom domain with your project. Email that comes from a custom domain has less chance of being marked as span.
  2. As a second step, consider setting up your own SMTP server.) for delivering the email, so that the emails are not being delivered from Firebase’s shared infrastructure anymore.

While these steps are more involved, they typically will drastically reduce the cases where the messages from Firebase Authentication are marked as spam.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading