I am developing a Android app with firebase as backend. I heard about firebase admin SDK but I don't know how to create it. I am using firebase console in web interface.
Now how can I set customer claims for a user?
You cannot. You could add custom claims from your local computer instead of Cloud functions or run a node process locally if you just need to add claims for a few users but the Admin SDK is necessary.
Checkout Firebase Custom Claims without Cloud Functions for detailed explanation on setting up admin sdk locally. You could just locally run functions or a node process to add claims as mentioned in there.
Related
I'm new to flutter working on my Final Year Project. I want to implement Admin functionalities in my App. So far I had implemented the data flow and the authentication things but I am stuck at implementing the Admin SDK for the removal of users from the auth table so that the admin has the complete priviligies.
Is there any alternate way possible? Or I have to implement the Admin SDK for this. Kindly guide? And if yes how should I do so?
The Firebase Admin SDKs are designed to be used in a trusted environment, such as your development machine, a server that you control, or Cloud Functions/Cloud Run. They are explicitly not to be used in client-side applications, like your Flutter app.
If you want to create a Flutter app that can be used to manage users, you'll want to:
Create your own API end points (e.g. with Cloud Functions or Cloud Run) where you use the Admin SDK to implement the necessary use-cases.
Secure those end points so that only authorized users can call them,
Then call the API end points from within your Flutter application code.
Also see:
How to use Firebase Admin SDK in Flutter?
is it possible to use firebase admin SDK in flutter web apps?
Flutter - Understanding Firebase Admin and how to get a user's information from email/uid/name
I've been making an Android application which requires some users to have administrative controls when logged in. I have researched into how this is possible and can see that it requires the use of Firebase Admin SDK running on a server. Now the problem i am having is how can i actually set this up to communicate with my application?
This is the first time i have tried making an android application and used servers. I have read the documentation but this still hasn't made it clear to me of the components i need and how to piece them together. So far i have prepared...
Android Application (Developed in Java using Android Studio)
Google Cloud Platform (Server App to run admin SDK)
... but now i need to understand how i can run the admin SDK on my Google Cloud Function and use this for authorisation in my android app. Any advice or direction to helpful documentation would be hugely appreciated!
If you've never done something like this before, I'd recommend starting with callable Cloud Functions. The documentation has a nice example of how to implement these and call them from your Android code.
Inside the Cloud Function you can then use the Admin SDK to access for example Firebase Authentication. See the documentation importing the required modules for an example of how to set up the Admin SDK, and then the documentation of the Admin SDK for an example of how to get a list of users.
I am currently working in an Android application that requires to have Admin and regular users. To illustrate, the admin has the ability to manage the regular users like delete , modify their contents. According to my reserch that firebase provide Admin SDK API that can be realy sutiable for this issue but according to thier documention that Admin SDK cannot be used in the Android project itself and should be placed in the server-side of the project. In addition, i was tried to add the Admin SDK debendence to my project dependences but there is conflict between the libraries . I know what i was did is wrong to add the Admin SDK to the Bulid.gradle (app) but i did not manage to figure out how i can add the Admin SDK to my project.
What you've found is correct. Your case seems to be suitable for using Firebase Admin SDK.
Firebase Admin SDK needs a server app, on which it will be initialized.
Here you can find a full list of the prerequisites for setting-up Firebase Android SDK.
You can set-up Firebase Functions, which will hold your server-side code. Inside those functions you can also initialize the Firebase Admin SDK.
Please refer here for more information on Firebase Functions.
Here you can find a sample Firebase application which uses the Admin SDK. The sample shows how to authenticate access to a JSON API to only allow access to data for a specific Firebase user.
Firebase Functions are built to serve as serverless code, as you develop your server-side logic, then deploy it to a managed environment on Google's cloud. Those functions can contain all the logic that you would like to have using Admin SDK.
for one of my assignments I have to make an Android app and I have to use a server and a service which can be a mobile service or a web service. So I was thinking of using Firebase as it is real time and have some good features.
BUT
I want to know for the above requirements of my assignment is Firebase suitable.
Also, I have been told to submit a deployment unit, I am guessing the deployment unit in this case is the APK file. Am I right?
EDIT
In my assignment specification it says "Server deployed in the cloud and server must be micro-service or web-service or mobile-service of your choice" which made me choose Firebase. But I am confused if firebase's server is in the cloud and if it uses any of the services mentioned above :/
Yes, Firebase has great services such as Realtime Database, Analytics, Storage, Remote Config, ... which help you to build your app.
The deployment unit in Android is ".APK" file. (If you are gonna develop a library, it will be ".AAR" file (Android ARchive file))
Firebase is a cloud-based technology that permits you to make with no server-side programming. It offers features like Realtime Database, storage options, Notifications, authentication options, hosting and more and there is no server side code required. Just put in the configurations and Firebase would handle it. Firebase lets you store user information and sync data between them in realtime.
My friend have finished setting up a Firebase backend for an Android application, and the project is on his private firebase account. Now I am starting to code the iOS version which should access the same Firebase backend.
My question is this... do I need to get his firebase email and password to work on the project or there is a way to import it to my account so I can work on it ?
tip: The solution should be like that, if any change happen in iOS or Android, must change in both of them.
You can add multiple developers to a single project, and you can have multiple apps added to your project. Do the following: your friend must add you to the project, and you must create an iOS application for that project in Firebase.