授予 Firebase 扩展程序的权限
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
要让 Firebase Extension 扩展程序执行其指定操作,Firebase 会通过服务账号向已安装扩展程序的每个实例授予对项目和数据的受限访问权限。
什么是服务账号?
服务账号是一种特殊类型的 Google 用户账号。它表示已获授权使用 Google API 访问数据的非人类用户。
在安装扩展程序的过程中,Firebase 会在您的项目中创建一个服务账号。每个已安装的扩展程序实例都有自己的服务账号。
Firebase 通过向扩展程序的服务账号分配特定的角色(一组权限)来限制对您的项目及数据的访问权限。运行扩展程序所需的角色由 Firebase 在扩展程序开发期间确定。安装时,Firebase 会将这些角色分配给扩展程序的服务账号,您不得修改、添加或删除任何这些已分配的角色(否则您已安装的扩展程序将无法按预期运行)。但是,您可以卸载扩展程序,此操作会完全删除服务账号(及其访问权限)。
为扩展程序创建的服务账号采用以下格式:ext-extension-instance-id@project-id.iam.gserviceaccount.com
。
您可以在 settings 项目设置的服务账号标签页中查看与您的 Firebase 项目关联的所有服务账号。
权限和角色
在扩展程序开发过程中,Firebase 会确定运行扩展程序所需的访问权限级别。
Firebase 通过明确列出在安装扩展程序时 Firebase 应分配给该扩展程序的服务账号的角色(一组权限)来定义此访问权限级别。
每个角色(及其固有权限)均基于特定的产品或服务。示例角色包括 firebasehosting.admin
、bigquery.dataEditor
和 firebasedatabase.admin
。Firebase 会在扩展程序的规范文件(extension.yaml
文件)中列出该扩展程序所需的角色。
对于官方 Firebase 扩展程序,Firebase 会仔细检查此角色列表,以确保扩展程序的访问权限严格限制在该扩展程序的任务范围内。您还可以通过访问 Firebase Extensions 信息中心的扩展程序详情页面或查看扩展程序的 README
文件,查看并确认授予该扩展程序的访问权限。
了解每个角色所包含的权限:
卸载扩展程序后会发生什么?
从项目中卸载扩展程序时,Firebase 会删除为该扩展程序实例创建的服务账号。删除服务账号后,扩展程序将无法在您的项目中运行,因为它不再具有对您的项目或数据的任何访问权限。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-13。
[null,null,["最后更新时间 (UTC):2025-08-13。"],[],[],null,["\u003cbr /\u003e\n\nFor a Firebase Extension to perform its specified actions, Firebase\ngrants each instance of an installed extension limited access to your project\nand data via a ***service account***.\n\nWhat's a service account?\n\n**A\n[service account](//cloud.google.com/iam/docs/understanding-service-accounts)\nis a special type of Google user account. It represents a non-human user that's\nauthorized to access data using Google APIs.**\n\nDuring installation of an extension, Firebase creates a service account in your\nproject. Each installed instance of an extension has its own service account.\n\nFirebase limits access to your project and data by assigning an extension's\nservice account specific [***roles*** (bundles of\npermissions)](/docs/projects/iam/roles). The roles that an extension requires to\noperate are determined by Firebase during extension development. At\ninstallation, Firebase assigns these roles to an extension's service account,\nand you shouldn't modify, add to, or delete any of these assigned roles\n(otherwise your installed extension won't work as expected). You can, though,\n[uninstall the extension](#uninstall-extension), which deletes the service\naccount (and its access) altogether.\n\nService accounts created for extensions are in the format:\n**ext-** \u003cvar translate=\"no\"\u003eextension-instance-id\u003c/var\u003e***@*** \u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e**.iam.gserviceaccount.com**.\n\nYou can view all the service accounts associated with your Firebase project in\nthe\n[*Service accounts*](//console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk)\ntab of your\nsettings *Project settings*.\n\nPermissions and roles\n\nDuring development of an extension, Firebase determines the level of access that\nan extension requires to operate.\n\nFirebase defines this level of access by explicitly listing the ***roles***\n(bundles of permissions) that Firebase should assign to the extension's\n[service account](#service-account) during installation of the extension.\n\nEach role (and its inherent permissions) is based on a specific product or\nservice. Examples of roles are `firebasehosting.admin`, `bigquery.dataEditor`,\nand `firebasedatabase.admin`. Firebase lists the required roles for an extension\nin the extension's specification file (the\n[`extension.yaml` file](/docs/extensions/overview-use-extensions#view-source-code)).\n\nFor official Firebase extensions, Firebase thoroughly reviews this list of\nroles to ensure that an extension's access is strictly limited to the scope of\nthe extension's tasks. You can also review and confirm for yourself the access\ngranted to an extension by viewing the extension's details page in the\n[Firebase Extensions dashboard](https://console.firebase.google.com/project/_/extensions/) or viewing its\n[`README` file](/docs/extensions/overview-use-extensions#view-source-code).\n\nLearn about the permissions included in each role:\n\n- [Firebase product-level roles](/docs/projects/iam/roles-predefined-product)\n- [Google Cloud\n roles](//cloud.google.com/iam/docs/understanding-roles#predefined_roles)\n\nWhat happens when I uninstall an extension?\n\nWhen you\n[uninstall an extension](/docs/extensions/manage-installed-extensions#uninstall)\nfrom your project, Firebase deletes the [service account](#service-account)\ncreated for that instance of the extension. After this deletion of the service\naccount, the extension cannot run in your project because it no longer has any\naccess rights to your project or data."]]