Firebase数据库访问权限丢失求助:原Gmail账号删除重建后无法访问
Hey there, let's work through getting your Firebase project access sorted out—since you're using Google Workspace (formerly G Suite) to manage accounts, there's a clear path to fix this issue:
先明确核心原因
Even though you recreated the same Gmail address, Google treats the new account as a completely separate entity (it has a unique internal ID different from the deleted original account). That's why the old permissions tied to the first account don't automatically apply to the recreated one.
Step 1: 用有权限的Workspace管理员账号操作
首先,使用拥有该Firebase项目Owner/Editor权限的Google Workspace管理员账号登录Google Cloud Console。因为Firebase项目本质上和Google Cloud项目绑定,权限调整需要在这里进行。
Step 2: 将重建的账号添加到项目IAM权限列表
- 进入项目的 IAM & Admin > IAM 页面
- 点击页面顶部的 Add 按钮
- 在「New principals」输入框中填入你重建的Gmail账号地址
- 为账号分配合适的角色:如果需要完整的Firebase管理权限,选择Firebase Admin;如果只需要基础操作权限,选Editor即可(也可以根据需求选择更细分的权限角色)
- 点击Save,等待5-10分钟让权限在谷歌服务中同步生效
Step 3: 验证Firebase访问权限
权限同步完成后,退出当前谷歌账号,用重建的Gmail账号登录Firebase Console,此时应该可以正常访问你的项目,包括实时数据库 (my-project).firebaseio.com。
Step 4: 修复数据库规则(若有需要)
如果你的实时数据库规则曾经指定了旧账号的UID(比如规则里写了 auth.uid === "old-account-uid"),需要更新规则适配新账号:
- 进入Firebase Console的 Realtime Database > Rules 页面
- 将旧UID替换为重建账号的UID(可以在 Authentication > Users 页面找到新账号的UID)
- 发布更新后的规则
内容的提问来源于stack exchange,提问作者Tremolidades

