2021年5月5日星期三

Firestore Admin Not Authenticating on Electron App

I'm creating an electron app as an interface for administrators. Currently using Real-time database and firestore. I'm using the firebase admin sdk with a local .json service account file to connect to the realtime database and perform all un-restricted read/write operations. Everything works as expected. However, when attempting to read/write to the Firestore database, I receive an error:

You need to pass auth instance to use gRPC-fallback client in browser. Use OAuth2Client from google-auth-library.

I did read online that other people had a similar issue and I've tried the following:

  • npm rebuild
  • install the @grcp/grcp packages
  • install the google-auth-library

Unfortunately, I still get the same response. I also get a lot of the following warning messages (each referencing a different js file), not sure if they are related:

DevTools failed to load SourceMap: Could not parse content for file:///Users/anaroca/Desktop/FCF-Admin/node_modules/@google-cloud/firestore/build/src/pool.js.map: Unexpected end of JSON input

This is how I have initiated the admin app:

var admin = require("firebase-admin");  var serviceAccount = require("./secret.json");  app = admin.initializeApp({    credential: admin.credential.cert(serviceAccount),    databaseURL: "https://project-name.firebaseio.com",    projectId: 'project-name'  });  

Any help is appreciated.

https://stackoverflow.com/questions/67409833/firestore-admin-not-authenticating-on-electron-app May 06, 2021 at 07:05AM

没有评论:

发表评论