title: two different app logins on single Firebase project Problem
body: <p>I have a Problem in the login. Basically, I tell you my scenario.
  I have two apps both are connected with a single firebase project. 
  One app contains driver login and other app contain customer login
  When I open a customer app and register the new customer. The customer is successfully registered. And then I open the driver app and entered the customer credential means (Customer email &amp; password) its login successfully and open the driver activity and vice-versa. </p>
  
  <p>how to fix this issue I am using firebase.</p>
  
  <p>customer login activity</p>
  
  <pre><code>    public class CustomerLoginActivity extends AppCompatActivity {
      private EditText mEmail, mPassword;
      private Button mLogin, mRegistration;
  
      private FirebaseAuth mAuth;
      private FirebaseAuth.AuthStateListener firebaseAuthListener;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_customer_login);
  
          mAuth = FirebaseAuth.getInstance();
  
          firebaseAuthListener = new FirebaseAuth.AuthStateListener() {
              @Override
              public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                  FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
                  if(user!=null ){
                      Intent intent = new Intent(CustomerLoginActivity.this, CustomerMapActivity.class);
                      startActivity(intent);
                      finish();
                      return;
                  }
              }
          };
  
          mEmail = (EditText) findViewById(R.id.email);
          mPassword = (EditText) findViewById(R.id.password);
  
          mLogin = (Button) findViewById(R.id.login);
          mRegistration = (Button) findViewById(R.id.registration);
  
          mRegistration.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  final String email = mEmail.getText().toString();
                  final String password = mPassword.getText().toString();
                  mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(CustomerLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if(!task.isSuccessful()){
                              Toast.makeText(CustomerLoginActivity.this, "sign up error", Toast.LENGTH_SHORT).show();
                          }else{
                              String user_id = mAuth.getCurrentUser().getUid();
                              DatabaseReference current_user_db = FirebaseDatabase.getInstance().getReference().child("Users").child("Customers").child(user_id);
                              current_user_db.setValue(true);
                          }
                      }
                  });
              }
          });
  
          mLogin.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  final String email = mEmail.getText().toString();
                  final String password = mPassword.getText().toString();
                  mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(CustomerLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if(!task.isSuccessful()){
                              Toast.makeText(CustomerLoginActivity.this, "sign in error", Toast.LENGTH_SHORT).show();
                          }
                      }
                  });
  
              }
          });
      }
  
  
      @Override
      protected void onStart() {
          super.onStart();
          mAuth.addAuthStateListener(firebaseAuthListener);
      }
      @Override
      protected void onStop() {
          super.onStop();
          mAuth.removeAuthStateListener(firebaseAuthListener);
      }
  }
  </code></pre>
  
  <p>driver login activity</p>
  
  <pre><code>    public class DriverLoginActivity extends AppCompatActivity {
      private EditText mEmail, mPassword;
      private Button mLogin, mRegistration;
  
      private FirebaseAuth mAuth;
      private FirebaseAuth.AuthStateListener firebaseAuthListener;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_driver_login);
  
          mAuth = FirebaseAuth.getInstance();
  
          firebaseAuthListener = new FirebaseAuth.AuthStateListener() {
              @Override
              public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                  FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
                  if(user!=null){
                      Intent intent = new Intent(DriverLoginActivity.this, DriverMapActivity.class);
                      startActivity(intent);
                      finish();
                      return;
                  }
              }
          };
  
          mEmail = (EditText) findViewById(R.id.email);
          mPassword = (EditText) findViewById(R.id.password);
  
          mLogin = (Button) findViewById(R.id.login);
          mRegistration = (Button) findViewById(R.id.registration);
  
          mRegistration.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  final String email = mEmail.getText().toString();
                  final String password = mPassword.getText().toString();
                  mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(DriverLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if(!task.isSuccessful()){
                              Toast.makeText(DriverLoginActivity.this, "sign up error", Toast.LENGTH_SHORT).show();
                          }else{
                              String user_id = mAuth.getCurrentUser().getUid();
                              DatabaseReference current_user_db = FirebaseDatabase.getInstance().getReference().child("Users").child("Drivers").child(user_id).child("name");
                              current_user_db.setValue(email);
                          }
                      }
                  });
              }
          });
  
          mLogin.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  final String email = mEmail.getText().toString();
                  final String password = mPassword.getText().toString();
                  mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(DriverLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if(!task.isSuccessful()){
                              Toast.makeText(DriverLoginActivity.this, "sign in error", Toast.LENGTH_SHORT).show();
                          }
                      }
                  });
  
              }
          });
      }
  
  
      @Override
      protected void onStart() {
          super.onStart();
          mAuth.addAuthStateListener(firebaseAuthListener);
      }
      @Override
      protected void onStop() {
          super.onStop();
          mAuth.removeAuthStateListener(firebaseAuthListener);
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5AJkl.jpg" rel="nofollow noreferrer">My database rules</a></p>