maxwellgover
maxwellgover

Reputation: 7121

Using Same Firebase App With Web and Mobile App

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>

Upvotes: 8

Views: 9816

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598797

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.

Upvotes: 23

Related Questions