简体   繁体   English

使用相同的 Firebase 应用程序与 Web 和移动应用程序

[英]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.所以说我正在使用 React 构建一个 web 应用程序,以及一个允许用户使用 React Native 拍照的移动应用程序。 I want to allow users to use the same login credentials when signing into the web app and also the mobile app.我想允许用户在登录 web 应用程序和移动应用程序时使用相同的登录凭据。 Can I use the same Firebase info for both the web app and mobile app?我可以为 web 应用程序和移动应用程序使用相同的 Firebase 信息吗? 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>

A single Firebase project can be used as the back-end for many (iOS, Web and Android) apps.单个 Firebase 项目可用作许多(iOS、Web 和 Android)应用程序的后端。 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.因此,如果您在单个 Firebase 项目上创建两个 Web 应用程序,这些应用程序将使用相同的数据库、相同的用户列表、相同的存储文件等。如果您随后添加一个 iOS 或 Android 应用程序,那也将访问相同的用户/数据库/文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何同时为移动和桌面制作 Flutter Firebase 应用程序 - How to do a Flutter Firebase app for both Mobile and Desktop at the same time 在何处生成 Firebase 数据库数据的 PDF - 移动应用程序或 Firebase 托管网络应用程序 - Where to generate a PDF of Firebase Database data - mobile app, or Firebase Hosting web app 如何使用 Firebase 身份验证保持用户登录 Flutter web 应用程序 - How to keep a user logged in Flutter web app using Firebase Authentication Flutter Web - No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app) - Flutter Web - No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app) 如何在Firebase上为web设置应用版本 - How to set app version on Firebase for web 同一个 Angular 应用程序中的多个 Firebase 项目 - Multiple Firebase Project in same Angular app 如何获取 Web App 的 Firebase Analytics App Instance Id? - how to get Firebase Analytics App Instance Id for Web App? Angular / Ionic 移动应用程序 ios 不使用 angularfire 从 Firebase 获取 - Angular / Ionic mobile app ios does not fetch from Firebase using angularfire FirebaseError: Firebase: 否 Firebase App '[DEFAULT]' 已创建 - 调用 Firebase App.initializeApp() {颤动网络} - FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app). {Flutter web} Firebase AppCheck web 应用程序无法在生产模式下工作 - Firebase AppCheck web app not working in production mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM