0

I have two apps in a single project. 1st is a customer app and 2nd one is company app. both apps share the same firebase database.

And both the apps are identical in terms of login and registration. When started writing code for the 2nd app, that time I copied the 1st project and modified all the activities (android java code) as per my needs.

The issue I am facing is when customers register in the customer app and then the same login credentials are being used to login in company app without registering to it or vice-versa. I don't understand why this is happening. I saw one thing that for both the project SHA-1 key is the same after generating from the android studio.

I want to restrict login to without registering to it for both the apps, the one should be able to login in to the app in which he/she has registered, not in the 2nd app where he/she hasn't registered.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193

1 Answers1

1

User registration is per project, and not per application. So Firebase makes no distinction between the users that sign in with the first app or with the second app, they are all just users within the project and they can authenticate against that project.

If you want to make a distinction between the two types of users in your project, you should not do that by the application they use to sign in. Instead you'll want to store some sort of role for each user either in the database, or in a custom claim in that user's profile.

I'd recommend checking out:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • I resolved my issue by putting extra field while registering on both the apps. AppType(new field), decides that which app users is trying to access which app out of two apps. Based on the database verification on the same field, I am allowing users to access the apps. I am doing this after firebase authentication. – Amit chaudhary Aug 24 '20 at 08:09