I've setup the firebase admin SDK using this guide
So I'm initializing it in the following way.
InputStream refreshToken = new ClassPathResource(CONFIG_FILE).getInputStream(); FirebaseOptions options = new FirebaseOptions.Builder() .setCredential(FirebaseCredentials.fromRefreshToken(refreshToken)) .setDatabaseUrl("https://<project-id>.firebaseio.com/") .build(); FirebaseApp.initializeApp(options); I got no errors to this point, everything seems fine. However, I'm unable to do any operations. Calling the methods does nothing. Eg:
FirebaseDatabase.getInstance() .getReference() .addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { //this callback is never called } @Override public void onCancelled(DatabaseError databaseError) { } }); or
class Pojo { public Pojo(String name, String surname) { this.name = name; this.surname = surname; } String name; String surname; //omitted getters and setters } FirebaseDatabase.getInstance.getReference() .push() .setValue(new Pojo("Test", "Test")); //this value is never set It simply looks like that the skd ignores any command. Any ideas?
Background: I'm running this as a web application (spring) on a local machine.