Check Login in Firebase

Asked

Viewed 1,430 times

0

Good afternoon ! I’m having a hard time in an app I’m creating with firebase... Next, I have the login workshop and in it I have the login button with the google account, what I want to do is the following, when the person selects the google account, after authentication I want to make a select there in firebase and confirm that all the registration data have been filled, if yes, the person is directed to the main Activity, if it is missing data such as schooling, profession etc., it means that he still does not have an account in the database Realtime, then he is directed to register using google email... my validation is like this, however, below pe only a test, as I am consulting the identifier q is the ID it should already be listed as registered because I can see in the firebase console, however, it always falls as false the first time and is taken to the registration screen, so intended that the following logic is missing something:

if (firebase.child("USUARIOS").child(identificador).equals( usuario.getId() ) ){
                            openMainActivity();
                        } else {
                            usuario.salvar();
                            openCadastroActivity();
                        }
  • Could you put your USUARIOS node in firebase? And also how you’re doing the reference (which I believe is the firebase variable in your code)

1 answer

0


From what I understand these trying to access the data firebase auth.

I suggest you create in firebase database a user node, and record/update the data whenever there is an authentication, as the firebase auth does not record the data you need and also does not allow you to search for restricted information.

Example:

firebase

After authentication and user save/update, create a data verification logic and open the desired Activity.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.