2

I have successfully build two apps (Admin and User) both using same Firebase realtime database. I want to separate the admin and the user app. Admin add the user, but the problem is that the user add by the admin is signing in user app and also in admin app. Kindly help me. I have no idea about admin Sdk, is there any way to get rid of this problem

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Ali Rao
  • 21
  • 2

1 Answers1

1

The Admin SDKs are meant to be used in a trusted environment, such as your development machine, a server you control, or Cloud Functions. They are explicitly not meant to be used in client-side applications.

The common approach to create an administrative app is to:

  1. Create your own server-side API, with either Cloud Functions or on your own server, and expose URL endpoints that can be called from an app. In this code you'll use the Admin SDK, and you'll implement both the logic you need (i.e. creating user accounts), and the logic to secure access to it.
  2. Then call this custom API endpoint from within you Android application.

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • yes i know, my app is not server-side. So please tell me what am i do to diffrenciate the admin and user. I want to bound the user not to login the Admin app – Ali Rao Feb 08 '20 at 06:09
  • That's a different problem, and has nothing to do with the Admin SDK. You'll need to somehow "tag" the admin users, for example through a custom claim, or in a database. Then when a user signs in to your admin app, you check if they're an admin, and only grant them access if they are. – Frank van Puffelen Feb 08 '20 at 06:14
  • and how to diffrentiate each admins data because every admins has its own users so i want the user only read write of their admin data – Ali Rao Feb 08 '20 at 10:31
  • That sounds like a different question altogether, by the simple fact that it'd require explaining about a different part of Firebase. Please read a bit about [how do I ask a good question](https://stackoverflow.com/help/how-to-ask), as it's been hard for me figuring out how to best help you. The easier you make it for us to help (by isolating the problem, limiting the scope, giving examples, etc), the more likely someone is to actually answer with what you need. – Frank van Puffelen Feb 08 '20 at 15:19