0

I have a React Native project and I want the user to be able to reset his or her password by click the reset password link. Right now they would be logged in so it is grabbing the email from the profile.

Right now, I click reset and it does not send any type of email so I am not sure why it is not sending that email. here is the code I have.

import { getAuth, signOut, sendPasswordResetEmail } from "firebase/auth"
...
const auth = getAuth()
const resetPasswordByLink = () => {
  console.log(user.email)
  sendPasswordResetEmail(auth, user.email)
    .then((response) => {
      console.log('response', response)
    })
    .catch((error) => {
      console.log(error)
    })
}
Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
ojandali
  • 133
  • 7
  • Do you see either response or error logged in the console? Also have you checked the spam folder? Also, if the user is logged in, why not use `updatePassword()` instead? User may have to enter their current password though. – Dharmaraj Sep 17 '22 at 17:50
  • I get undefined in the response. I am doing it just to test it and get it working before I add it to the login page so i dont have to keep typing in an email ahaha @Dharmaraj – ojandali Sep 17 '22 at 17:54
  • We've seen lot of these messages being marked as spam recently. Did you check the spam folder of your mailbox? https://stackoverflow.com/questions/72922475/why-did-this-code-fail-to-send-password-reset-link-in-firebase/72922603#72922603 – Frank van Puffelen Sep 17 '22 at 17:55
  • Yeah it was in the spam folder. Is there a way to prevent that from happening?? @Dharmaraj – ojandali Sep 17 '22 at 18:00
  • Sounds like a similar issue in the question shared by @FrankvanPuffelen in that case. You can try any of the solutions mentioned in his answer. – Dharmaraj Sep 17 '22 at 18:01

0 Answers0