Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Same Firebase App With Web and Mobile App

Tags:

firebase

So say I am building a web app using React and also a mobile app that allows users to take a photo using React Native. I want to allow users to use the same login credentials when signing into the web app and also the mobile app. Can I use the same Firebase info for both the web app and mobile app? Like just include the snippet below in both code bases to allow them to both use the same database, storage, etc?

<script src="https://www.gstatic.com/firebasejs/3.6.1/firebase.js"></script>
<script>
  // Initialize Firebase
  // TODO: Replace with your project's customized code snippet
  var config = {
    apiKey: "<API_KEY>",
    authDomain: "<PROJECT_ID>.firebaseapp.com",
    databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
    storageBucket: "<BUCKET>.appspot.com",
    messagingSenderId: "<SENDER_ID>",
  };
  firebase.initializeApp(config);
</script>
like image 266
maxwellgover Avatar asked Dec 12 '16 19:12

maxwellgover


People also ask

Can two apps use the same Firebase database?

Yes, You can use the same firebase database in more than one android application as below: In the Project Overview section of Firebase Console add an android application. For adding this application first you need to give that package name.

Can I use the same database for website and mobile app?

So I'm thinking of using the same database (Firebase) for both for mobile app and web-based system so that any new data added into the Firebase through the website will be automatically updated in the mobile app as well. Is this doable? Yes, you just need to use the Firebase config of same project.

Is it possible to have multiple iOS Android and web apps under a single Firebase system?

A Firebase project can have one or more Firebase Apps registered to it (for example, both the iOS and Android versions of an app, or both the free and paid versions of an app).

Is Firebase for web or mobile?

Firebase provides detailed documentation and cross-platform SDKs to help you build and ship apps on Android, iOS, the web, C++, and Unity.


1 Answers

A single Firebase project can be used as the back-end for many (iOS, Web and Android) apps. All these apps will be talking to the same back-end services.

So if you create two web applications on a single Firebase project, those apps will be using the same database, the same list of users, the same stored files, etc. If you then add an iOS or Android app, that will also be accessing the same users/database/files.

like image 96
Frank van Puffelen Avatar answered Sep 21 '22 12:09

Frank van Puffelen