1
4 Comments

Firebase/React Native - Forgot Password (Help!)

Hey IHs,

I'm writing for some direction on a problem i have with my react native / firebase project. I need to setup "Forgot Password" functionality and am struggling to understand the best way to go about it.

My app will include payments so I need to enforce stricter password parameters than the default firebase requirements (6 characters or more). I currently have functionality setup for entering the users email address then receiving a password reset email from firebase, this opens a web page to change the users password. The problem is that this page doesn't enforce the same password requirements that I need it to, but i cannot edit it because it's Google's.

What's my options for password reset using my own password requirements? I need some sort of callback to the app when the link in the email is clicked? Any information or direction is greatly appreciated.

Thanks!

posted to Icon for group Developers
Developers
on April 8, 2020
  1. 2

    It doesn't seem to go out-of-the-box with Firebase.

    Here's a good Stackoverflow post that gives you a few options: https://stackoverflow.com/a/49184693/3878449

    1. 1

      Thanks very much for your reply, really appreciate it. I’ll look into this.

  2. 1

    You could solve this with a serverless function. Edit the email template with a link to your website that has a password reset form. For example https://my-website.com/resetPassword?oobCode=<code> and there you could have a form prefilled with a hidden field that contains the oobCode and a "new password" field that's shown to the user. Those both values you send to the serverless function that does the password validation. If the validation goes through, the serverless function sends a request with the oobCode and newPassword to
    https://firebase.google.com/docs/reference/rest/auth#section-confirm-reset-password
    to reset the password.

    1. 1

      Hi @backendbro,

      Thanks a lot for your thoughtful response. I think this is a logical way of doing it. I’m going to read through the material supplied here and hopefully figure out a solution. Thanks for your effort I really appreciate it.

      Cheers,

Trending on Indie Hackers
I shipped 3 features this weekend based entirely on community feedback. Here's what I built and why. User Avatar 152 comments I'm a lawyer who launched an AI contract tool on Product Hunt today — here's what building it as a non-technical founder actually felt like User Avatar 138 comments Finally reached 100 users in just 12 days 🚀 User Avatar 126 comments “This contract looked normal - but could cost millions” User Avatar 46 comments 👉 The most expensive contract mistakes don’t feel risky User Avatar 37 comments I realized showing problems isn’t enough — so I built this User Avatar 32 comments