[英]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.