如何对两个不同的Flutter应用程序使用相同的Firebase Auth? [英] How to use the same Firebase Auth for Two different Flutter apps?

查看:50
本文介绍了如何对两个不同的Flutter应用程序使用相同的Firebase Auth?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了两种不同的Flutter应用程序.管理员版本和另一个客户端版本.我想使用相同的登录名(auth)并访问两个应用程序的存储.

I developed two different Flutter applications. An Admin Version and another Client Version. I would like to use the same login (auth) and access to Storage for both Apps.

推荐答案

绝对有可能从两个不同的应用程序访问相同的Firebase项目.实际上,当这些应用程序在本地是同一应用程序"的一部分时,这实际上是预期的用例.

It's definitely possible to access the same Firebase project from two different apps. In fact, when these apps are locally part of the same "application", that is actually an intended use-case.

请记住以下几点:

  1. Firebase身份验证没有管理员用户的概念.它仅"对用户进行身份验证,允许他们使用其凭据登录.任何管理员逻辑都特定于您的应用程序,因此通常称为应用程序管理员.您通常会想要标记应用程序管理员,例如通过设置自定义标签对其帐户提出索赔.

并非所有应用程序管理员可能需要的功能都将在Firebase的客户端SDK中提供.常见的情况是,管理员应该能够为其他用户创建帐户,而客户端Firebase身份验证SDK不支持此逻辑.有关此内容以及如何解决的更多信息,请参见 Firebase踢出当前用户和我的答案,其中包含许多链接如何创建firebase管理员用户以java 进行身份验证.简而言之:您必须在受信任的环境中使用Firebase Admin SDK来执行其中的某些操作.

Not all functionality that the application administrator may need is going to be available in Firebase's client-side SDKs. A common scenario is that the administrator should be able to create accounts for other users, where the client-side Firebase Authentication SDKs don't support this logic. For some more information on this, and how to solve it, see Firebase kicks out current user and my answer with many links here How to create firebase admin user for authentication in java. In a nutshell: you'll have to use the Firebase Admin SDK, in a trusted environment, for some of these operations.

然后您通过编写安全规则来保护对Cloud Storage的访问.有关基于用户保护访问权限的一些示例,请参见保护用户数据的文档.

You then secure access to Cloud Storage by writing security rules. For some examples of securing access based on the user, see the documentation on securing user data.

这篇关于如何对两个不同的Flutter应用程序使用相同的Firebase Auth?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆