it was created a user document in cloud firestore database while registration. User are able to login if comparison is true. problem is firebaseuser return null with FirebaseAuth.getInstance().getCurrentUser() as it's not recognized a current login user.
My question is, is it possible to map a user from user document to a firebase user? I know I can use firestore built-in authentication. but is not a good time for me to change with my deadline.
this is login code
db.collection("users")
.whereEqualTo("UserName", tools.editText.get(R.id.username_txt))
.whereEqualTo("Password",tools.editText.get(R.id.password_txt) )
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete( Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
if(task.getResult().size()>0) {
Log.w("Rabby","success");
Intent i=new Intent(LoginActivity.this,HomeActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}else
{
Toast.makeText("invalid user").show();
}
} else {
}
}
});
after user login, I cannot get a current user coz firebase.getcurrentuser() does not know the login user. it is possible to map user to firebase user? anyone can suggest me? a million thanks