0

I have a web app made mainly with Vue JS calling a Firestore database to display data, along with Google Cloud Functions that handle automatic mechanisms.

My question is quite simple, can I use the Firebase Admin SDK on my web app?

Currently in my web app I am using this code to connect the DB:

import firebase from 'firebase';
import '@firebase/auth';
import '@firebase/firestore';

...

// Initialize Firebase
const firebaseApp = firebase.initializeApp(config); // const app = initializeApp(config);
this.database = firebaseApp.firestore();

I would like to be able to use the select keyword for the Firestore database requests in order to select only the fields I want to retrieve from a Collection. But that keyword is not available on my web app through that implementation. So I wonder if it is reserved to Google Functions (even though I don't see why it is not available everywhere).

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
Yoann Hercouet
  • 17,894
  • 5
  • 58
  • 85
  • Admin SDK requires a service account to be initialized and it should not be used on client side. If you want to use select(), then try using Cloud Functions or your own server to use Admin SDK. Alternatively, checkout the Firestore [REST API](https://cloud.google.com/firestore/docs/reference/rest/v1/DocumentMask) – Dharmaraj Jan 25 '23 at 09:10
  • Ok thansk for the clarification, I hope they will make this keyword available everywhere... – Yoann Hercouet Jan 25 '23 at 09:12

0 Answers0