Firebase login user with custom username

Umair Iqbal :

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.

Alex Mamo :

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.

edited at
0

Comments

0 comments
Login to comment

Related

Unable to retrieve the user identity (userName and password)from mysql to login

Django user creation return "Key 'username' not found in 'CustomUserForm'" for custom user

Swift & Firebase | Checking if a user exists with a username

Show the username in the top when the user is login

Firebase. Change `username`(email) of registered user

Retrieve user email for username signing firebase

Delete Firebase user with username and password verification

Is it possible to login as another user in Firebase?

Django login user=username never true

Can not log in - Login failed for user 'username'

Firebase Login: User can login with wrong credentials

Reload a Tableau custom SQL DataSource (live) with a parameter = username() after a logout and login with a different user

SQL Exception - Login failed for user "UserName$"

Username at LXDE login screen won't remember user

Firebase Login as other user

Firebase user registration with username atomicity

DataTables warning: table id=[tablename] - Login failed for user 'username'

Laravel 5 custom login with username OR email using the Attempt method

Firebase User Registration / Authentication with Username

Firebase login using username (not email)

Login user for a custom user model with email as username field

Login User with Firebase Authentication

Login with existing user token in firebase

Custom Firebase Authentication with Username and Password

Avoid user Login with Firebase on Creation

Multiple firebase user login

Check for username without login/user_credential

Login a user with their firebase user id react native

Unable to login in custom user model