Search code examples
firebasefirebase-hostingfirebase-console

What benefit does linking Firebase web app to Firebase Hosting site brings?


What for should I link the web app to the Firebase Hosting site in the console? What are the benefits and effects?

console

The difference between the two is covered here: Whats the difference between firebase web app and firebase hosting.

The linking is mentioned in the documentation https://firebase.google.com/docs/web/setup#register-app, but the rationale and consequences are not explained.


Solution

  • The Firebase support documentation says:

    You may need to link your web app to your Hosting site in the Project settings if you chose not to set up Hosting when you registered your web app with your Firebase project.

    If you're using Firebase Hosting for your web app, you can use the reserved Hosting URLs to add Firebase SDKs and manage your Firebase configuration for your app.

    In short, if you're using those special Hosting URLs that begin with __, in particular, /__/firebase/init.json, it helps to have linked your app to Hosting so that the configuration is complete. By my recollection, the config will then have a correct FCM config in this case.