Skip to content

How do i get the new Password stored in my firebase realtime database in android studio

I just realized that when I press the forgot password in my app and change the password the password is not changed in the realtime database.Is it possible to change the realtime database as well? This is my forgot password page code

public class ForgotPassword extends AppCompatActivity {
    EditText useremail;
    Button password;
    FirebaseAuth auth;

    protected void onCreate(Bundle savedInstanceState) {
        password.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                auth.sendPasswordResetEmail(useremail.getText().toString()).addOnCompleteListener(new OnCompleteListener<Void>() {
                    public void onComplete(@NonNull Task<Void> task) {
                            Toast.makeText(ForgotPassword.this,"Password sent to your mail",Toast.LENGTH_LONG).show();

this is the value stored in my database

  "Users" : {
    "Driver" : {
      "S04QBZx3PxYaLfDWBC3j3otM5ml1" : {
        "mail" : "[email protected]",
        "password" : "1234567",
        "username" : "YUSUF"


Firebase Authentication doesn’t store the user credentials in the Firebase database.

If the user credentials are stored in the database, it’s because your application code stores it there. You will need to update it in the database by running the same code as you ran when you saved the credentials in the database initially.

Something like this could for example update the password:

    .child(uid).child("password").setValue("new password");

Note: it is a really bad idea to store the user’s credentials in clear text like you’re doing, and I highly recommend leaving it to Firebase Authentication to store that data securely for you.