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: "....",
}
use of the app object
we get and keep a reference to the app object as we must provide it when using services such as auth or firestore.
embed the config in the app object
On the client, we embed the configuration in 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 we don't provide any config object to initializeApp()
.
const app = initializeApp() // on google server