I'm developing an Android application in which the user is logging in using Firebase Email, Password authentication method. While registering users with Email and Password, I'm pushing other user profile data too in firebase realtime database like username, number address, etc. What I want to ask, Is this possible while logging in other than what Firebase asks to use email and password for login is this possible that I used the username instead of email and password should be the same which I entered while registering with email, password.
Here the tricky part is username
is saved in DB but password
is not as we know while registering with email and password nothing gets saved in DB. I will get a username by querying.
ref.child("credentials").orderByChild("usernames").equalTo(username).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
// **here how should I match that this username is of same user with email and password**
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
But In the password field, I want to type the password that I entered with email while registering and that is not saved in DB so how should I get that and matched with each username accordingly that it is of the same username or not.
What I want to ask, Is this possible while logging in other than what firebase ask to use email and password for login is this possible that I used the username instead of email and password
No, when the user is new, signs in for the first time, the credentials (email and password) that are provided by the user are stored. You can see that in the Firebase console, in the authentication section. In order to log-in, the user needs to use the exact same credentials that exist in the database. There is no way you can log-in with a username. If you need such functionality, you should write code yourself, that can handle the entire authentication process but IMHO, I don't recommend this.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments