Initialization
config object
The config object allows the client to identify itself when talking to the Firebase services.
const firebaseConfig = {
apiKey: "....",
authDomain: ".....firebaseapp.com",
projectId: "....",
storageBucket: ".....appspot.com",
messagingSenderId: "....",
appId: "....",
}
the app object
we get and keep a reference to the app object to provide it to services such as auth or firestore.
embed the config in the app object
On the client, we provide the config to the app object , through initializeApp()
.
const app = initializeApp(firebaseConfig)
cloud functions: pre-configured
On a server managed by Google, the admin SDK is automatically configured, so that we don't need to give the config to the app.
const app = initializeApp() // on google server