Home > Net >  Getting Firebase Client Config key/values from within Firebase Admin backend?
Getting Firebase Client Config key/values from within Firebase Admin backend?

Time:07-26

Context:

  • Backend gets firebase client config key/values (apiKey, authDomain, etc) and passes it to client
  • Client uses said config to set which Firebase App it initializes into
  • Node backend

I've been browsing the firebase-admin npm module and have yet to find anything that points me in the right direction. Er, actually let me correct myself, the only thing I can't seem to acquire from the backend is the apiKey and appId

CodePudding user response:

The closest API I know of are the projects/get and the projects/getAdminSdkConfig in the REST API. I'm not sure if that is wrapped in the Admin SDK though, as I don't immediately see them in the most promising section of its reference docs.

CodePudding user response:

You must not pass your keys to client, they are sensitive data and must stay in your backend env, sou they are built-in when you build your application and keep safe in there. You should make a request asking data from client to backend to get this information, and your backend will be responsible to connect with firebase, get data and send it to frontend

client <> backend <> firebase

and not

backend <> client <> firebase

  • Related