Firebase: Replace data without create new values

Hello everyone! I need a littel help with Firebase

I am currently develop an app with sign in. Im using real database with Firebase and i want to add an option where the user can replace his password
I´ve tried already to save again data but i dont want to let users save new data, just modify their own password.
Is this possible?

Thank you so much for your time!


Of course it is possible. Password - this data and there is no problem to change the data using a variable and save them back.

1 Like

Thak you for your answer. I am not sure I understood
I forgot to say that i am not usign Autentification to this sign in, i just read/save the values from real data base from Firebase

This is how i save data
I check if password is correct and ther is no empty values

If i do this i can replace the data Password, but with this option i also can save new values. The users must not be able to create new entries

First of all, for security reason, you have to set Rules to your Firebase If you store user’s password manualy in firebase DB!

Then if you have done that, you should set define your users by UserName or ID’s
After finding user, set the Path/To/Place/ you want users change their password.
It will always replace the value of Password Table in your DB

Something Like This: :point_down:

1 Like

Thank you so much for your answer.
I think i understand the main idea but i dont get the Path/To/Place part.
Is like to giving an specific “andress” to search? how can i set this in realtime_db? Could you please give me a real example?
It would be really helpful to understand the logic behind this instead just copy a code. Thanks a lot

Hi @id.salazar88zrunh

Have you considered using the Sign In component for this?

There’s a full tutorial on this component here:

Thank you for your answer. I have considered but in this specific app i don´t want to incorporate email Authentication, just a simple LogIn with realtime database.
Actually it is simpler to replace a password with the components in Authentication but i don´t want to use emails for this app

1 Like

I have tried this and it works… but at the same time someone can set a new value for userID and a new password and with this make a new user… How do I restrict that option?