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
1 small portfolio change got me 10x more impressions User Avatar 30 comments AI Is Destroying the Traditional Music Business and Here’s Why. User Avatar 29 comments Fixing my sleep using public humiliation and giving away a Kindle User Avatar 23 comments A Tiny Side Project That Just Crossed 100 Users — And Somehow Feels Even More Real Now User Avatar 18 comments From 1k to 12k visits: all it took was one move. User Avatar 11 comments Retention > Hype: What Are We Really Chasing as Builders? User Avatar 9 comments