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.
Related
I currently have 2 firebase/google cloud projects. One for frontend and one for backend where app engine is hosted. I wanted to use firebase to send push notifications from the FCM token.
The code that I am using is the following:
Firebase.app = admin.initializeApp();
What this does is that it uses my backends firebase project not the firebase project of my frontend.
To connect to a different project's firebase I will have to do the following to my knowledge:
Firebase.app = admin.initializeApp({
credential: admin.credential.applicationDefault(),
});
And I will need to have an environment variable named GOOGLE_APPLICATION_CREDENTIALS
which will have to point to a google-credentials.json file containing the JSON object with the google credentials of the different applications.
I don't upload my google credentials json file as I am using cloud build from my Github.
I was trying the following approach:
Create a Base64 string of the json object and store it in a variable and then create a json file from the decoded base64 string and then point to the GOOGLE_APPLICATION_CREDENTIALS to the created file. But the google app engine does not allow for writing to files, so this is a dead-end unless there is something that will allow me to write to a file.
Is there some way I can link the firebase project of the frontend to the google cloud project of my backend so that the google cloud project directly links up the frontend's firebase project. If not then is there a way in which I can migrate the firebase project easily from the frontend firebase project to the backend firebase project?
Any suggestion would be a great help. Thanks!
There is no direct way to migrate the Firebase Application from one project to another project. You can refer to this stackoverflow thread to find this.
Also there is no way to migrate an App Engine application from one project to another. Instead you have to deploy the App Engine application in the new project.
So your concern narrows down to the fact that which one will be easier for you. I would suggest deploying the App Engine application in the same project where your Firebase frontend is already present. Because it seems easier as you only have to change the default project configuration in your SDK or Command Line Interface and follow this documentation.
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.
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.
I'm trying to build a library allows users to receive Firebase notifications from our server, while still allowing any third-party developer to set and receive their own Firebase notifications.
I'm struggling with how to do this, especially on the console side. I know you have to register your app's applicationID (project name) with the Firebase and then you receive a google-services.json file to add to your app. How does this work with multiple apps with a different package name for each? In my Firebase console, am I continuously adding the project name of each app that uses my library. That doesn't seem right. And how does the google-services.json file handle multiple senders, and which sender generates it?
I'd appreciate any insight from someone with experience in this area.
What you're trying to do is not generally supported by Firebase. The only supported use is at the application level, not for reuse by other libraries.
That said, some of the features can be used this way if you're willing to initialize them directly in code rather than using the google services Gradle plugin. For example Realtime Database can be programmatically initialized by calling FirebaseDatabase.getInstance(), and you make sure that you're also initializing a dedicated FirebaseApp object to pass to it.
Each Firebase feature has its own static initializer like this. However, if it requires a Context parameter (as with Analytics and Remote Config), you won't really be able to use it safely from a library, because it has no way to separate usage between different components within the app.
For more details, also read:
How does Firebase initialize on Android?
Take Control of your Firebase init on Android