I am using flutter web and firebase authentication. I want to use firebase admin SDK to manage users from my flutter web application. Is it possible to use firebase admin SDK in flutter web apps. please let me know is it possible or not.
If possible please let me know the previous example links or some information. I have searched on internet but I did not get the information.
From the Firebase documentation on Adding Firebase to your server:
Add the Firebase Admin SDK to your server
The Admin SDK is a set of server libraries that lets you interact with Firebase from privileged environments to perform actions like:
...
As said, the Admin SDKs are designed to be used in privileged environment, since using them gives you full administrative control to your Firebase project. Using it in another context would be a huge security risk, so is not possible.
If you need certain functionality from the Admin SDK in your web app, you can:
Use the Admin SDK in a trusted environment, such as your development machine, a server that you control, or Cloud Functions, to implement that functionality.
Then wrap that code in a custom API that you can call from your client-side code. If you've never done this before, Cloud Functions again provides a good starting point.
In your server-side code, ensure that only authorized users can invoke it.
Related
So what Im trying to do is, create a central project that holds all auth credentials and base user information in Firestore. Then have other projects connect to that project to gain access to individual apps. An example of this would be the following:
Project A - Auth Project
Project B - App 1
Project C - App 2
Project B Authentication -> Project A Authenticate And Give Project B Firestore User Object
Project C Authentication -> Project A Authenticate And Give Project C Firestore User Object
Anyone have any idea how I can do this? I have an idea that I may be able to do it with Firebase functions but can I also do it from the frontend such as from an iOS app? Would that require two Firebase Config files? If so how do I differentiate between the two of them in the iOS app?
A little more context on this. I am finished creating my first app. I am beginning to create an app that is completely different from the first app but I need my users to be able to share credentials across both apps. So my plan is to create a single project that holds the master user record and authenticates users from both of the other projects. Does this make sense? Also users will only authenticate using email/password combo, nothing else.
Any help would be greatly appreciated. Thanks.
You can check these official documentation on how to configure multi projects and understanding the firestore app and projects in detailAs,any Firebase project is governed by the Firestore security rules basically implement the security model which does refuse data or accounts outside of the project where they were deployed.You can try to implement with some backend API which can communicate between the two systems maintaining these security constraints.Also,If you want users from project B and project C to share credentials which have been authenticated in project A and you can let the user authenticate with the same UID with a "parallel" account in the second project rules on B would still be limited to the app and data for the immediate project and would not be able to access anything directly into other one.
I recommend you to check the following examples for the similar approach:
Use Firebase auth data and users for multiple project and apps
Single firebase project for multiple GCP projects
Implementing cross project user authentication
I just wonder why flutter application using node.js??
I make mine only flutter and firestore but so much fcm in flutter docs teach me using node.js!
so I want to know what is node.js and why need to nodes in flutter.
I think just server is firebase // view and backend is flutter
You need node to communicate to your firebase server, forming an API endpoint you can call in your flutter app. So technically node.js is more of backend environment code.
You can use the Firebase as your backend or you can choose to make your own backend creating an API. If you choose to create your own backend, there aren't differences to Flutter if that API will be developed using NodeJS / Dotnet / Django or any other framework.
The choose between your own backend or Firebase will depend of your project. Firebase is very scalable but you need to see the price of this, if your project becomes something big.
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
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:
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.
Then call this custom API endpoint from within you Android application.
Also see:
Firebase Admin SDK Android (with an answer from the main author of the SDK)
Firebase Admin SDK for Android, methods not found
Firebase admin sdk not syncing with the gradle
I am using GoolgeFirebase for my android application. I want to make an admin portal at GoogleFirebase connected to that application's database to view some admin related tasks, like showing waiters with rating where i have all the wiaters and rating data stored in Google Firebase Realtime Database.
Do i have to create a web app, connected and hosted at the Google Firebase or the GoogleFirebase facilitate itslef for creating some admin portal for the android app.
You have to build something. A web app using firebase hosting is really easy but you can host it anywhere you want including on your own PC. Of course you can also build any kind of app using one of the SDKs or anything that can do HTTPS requests. An special admin android app is an option. Java desktop GUI app may be to your liking.
Sometimes I find building a commandline tool in node.js is perfect for my needs. The command line lets me pipe the output to other tools that are helpful.
Firebase provides a number of Admin SDKs to help build server-side or desktop applications. As of now there are Admin SDKs available for Node.js, Java and Python (although the Python SDK is new and doesn't have realtime DB support yet). You can use one of these SDKs to build your admin portal webapp.
I'm thinking of prototying a web and ios app in meteor, if I find there is traction I would like build a native app (non phonegap). I want keep to keep my existing mongo data (user accounts, fb tokens, etc), and build the api in node/express for native ios app. However, I'm not sure how to migrate the user auth to use token based authentication when migrating to node.
P.S my app isn't reactive/realtime and doesn't necessarily require I use ddp.
thanks