Update password in realtime database and authentification - Firebase

hello everyone, my current application is very simple, it has registration, login, forgot password and forgot email. I am using firebase authentification block “send reset password email” when my user wants to change their password, as shown below

image

so, it just sends an email typed by the person by firebase itself, where their password changes in authentification. The problem is that it doesn’t change automatically, either, in the realtime database, which has a tag called “senha” (password).

When the person chooses “update e-mail”, they have to type the password that is in realtime, not in auth. that is, who confirms whether the password is the same in the database, is realtime.

Thus, my question: is there a way to change a password with an email sent by auth, which also changes the password in realtime? or a way to compare the password entered by the user with the password from auth, not from realtime?

image

I’ve already researched about it in the community and on YouTube, but either I can’t find it, or it’s outdated content.

I really appreciate the help!

my current aia: FitterTech (1).apk - Google Drive

android version: 12

I solved it! Guys, what I did was the following, as shown in the photo below:

aa

my global variable is the id user in auth. i do the normal login process as shown below

image

What I did, as shown in the first image, is that every time the user changes the email or changes the password, if they are authenticated, the moment he logs in again the “password” and “email” tags will be deleted from the database and new email and password tags will be created with the new data in place of the old ones. Thus, both auth and realtime are updated with the same data and without interrupting the user.

It may not be the best method, but it works. As this project is urgent, it has been great for me, and I intend to optimize it in the future.

(also, i do the same when i update email. i ask for the password, then if it’s authentificated, the database delete the old email tag and replaces with the new one)

Thanks!

2 Likes

Update: I tried to use the “append tag” instead of using “clear tag” and again “store tag”, but it did not work, so i’ll keep the last solution

Hi !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.