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
Your SaaS Isn’t Failing — Your Copy Is. User Avatar 61 comments The Future of Automation: Why Agents + Frontend Matter More Than Workflow Automation User Avatar 21 comments No Install, No Cost, Just Code User Avatar 20 comments Build AI Agents & SaaS Apps Visually : Powered by Simplita ai User Avatar 17 comments AI Turned My $0 Idea into $10K/Month in 45 Days – No Code, Just This One Trick User Avatar 13 comments How Growth Actually Kills your Startup User Avatar 6 comments