2

I am using Java admins SDK to connect my firebase + I am using App check.

When I try to read or write data using admin SDK the action fail, because of App check.

so my question is how to check admin SDK?

    FirebaseOptions options = new FirebaseOptions.Builder().setCredentials(GoogleCredentials.fromStream(
                new ClassPathResource("/myproject-firebase-adminsdk.json").getInputStream()))
                .setDatabaseUrl("https://myproject-default-rtdb.firebaseio.com").build();

        if (FirebaseApp.getApps().isEmpty()) {
            FirebaseApp.initializeApp(options);
        }

    DatabaseReference ref2 = FirebaseDatabase.getInstance().getReference("/users");
         ref2.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                Object document = dataSnapshot.getValue();
                System.out.println(document);
        }

        @Override
        public void onCancelled(DatabaseError error) {
            System.out.println(error);

        }
    });
MehdiS
  • 89
  • 5

0 Answers0