Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Firebase working with Java backend

First of all I'd like to apologize if this question is to abstract or unsuitable for this site. I really don't know where else to ask.

Currently I have developed apps in iOS and Android. They keep all their state in firebase, so everything is instantly persisted to the Firebase Realtime Database.

Before a user is created I populate the realtime database manually with some data that is expected to be there so that the app can run, such as config data for the user. When I'm "done" using the app I view the data directly in the Firebase console.

Now I want a backend to do the job I have done manually. I want the backend to be able to populate the realtime database and I want it also to be able to retrieve data from Firebase. I would like this to be done from a Java backend(Spring MVC but that might not be critical information right now).

How should I go about doing this? Googling hasn't gotten me that far(java+backend+firebase mostly tells me that "Firebase offers a backend to Android Java").

If this is the wrong place to post this, then please suggest where I can post it instead.

Edit: I am aware of the Server SDK. I am rather referring on how to implement this in what would typically be a stateless rest solution than specifically how the methods in the Server SDK are executed.

like image 496
why_vincent Avatar asked Nov 01 '16 11:11

why_vincent


People also ask

Can Firebase work with Java?

The Firebase Admin Java SDK enables access to Firebase services from privileged environments (such as servers or cloud) in Java. Currently this SDK provides Firebase custom authentication support, and Firebase realtime database access. For more information, visit the Firebase Admin SDK setup guide.

Can Firebase be used for backend?

Firebase is a Backend-as-a-Service (BaaS) app development platform that provides hosted backend services such as a realtime database, cloud storage, authentication, crash reporting, machine learning, remote configuration, and hosting for your static files.

How do I use Firebase authentication in backend?

To do this, you can retrieve an ID token from a client application signed in with Firebase Authentication and include the token in a request to your server. Your server then verifies the ID token and extracts the claims that identify the user (including their uid , the identity provider they logged in with, etc.).


1 Answers

Firebase has its own RestApi, you can use it in your api https://firebase.google.com/docs/database/rest/start

like image 138
Alex Shutov Avatar answered Sep 21 '22 09:09

Alex Shutov