Forgot password in Firebase for Android

rut_0_1 picture rut_0_1 · Mar 15, 2017 · Viewed 52.3k times · Source

I believe there is a way for changing your password in Firebase but is there a way where the user forgets the password and can be assigned a new one or re-authenticated using email or SMS OTP. I checked out on the net but couldn't seem to find one.

If there is a way how can it be implemented, what all function calls need to be made. Could you direct me with an example.

Answer

Frank van Puffelen picture Frank van Puffelen · Mar 15, 2017

It sounds like you're looking to send a password reset email. See this example from the Firebase documentation:

FirebaseAuth.getInstance().sendPasswordResetEmail("[email protected]")
    .addOnCompleteListener(new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful()) {
                Log.d(TAG, "Email sent.");
            }
        }
    });