You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行flutterfire configure创建Firebase项目报403无权限如何解决

问题描述
  • 首次使用Firebase CLI,已完成账号注册流程,登录Google Cloud控制台并同意服务条款,该步骤已解决最初的启动报错
  • 参照教程执行flutterfire configure命令创建项目时触发403错误。检索同类问题的通用解决方案均提示需联系项目管理员分配角色,但本人为项目所有者,仅执行新建项目操作仍出现报错
  • 具体现象:执行flutterfire configure输入项目ID后,CLI返回403错误,但对应的Google Cloud项目已在Google Cloud控制台中成功创建
关键报错信息

核心接口报错片段

[debug] [2022-06-02T06:28:10.130Z] <<< [apiv2][status] POST https://firebase.googleapis.com/v1beta1/projects/xnotes26657:addFirebase 403
[debug] [2022-06-02T06:28:10.130Z] <<< [apiv2][body] POST https://firebase.googleapis.com/v1beta1/projects/xnotes26657:addFirebase {"error":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED"}}

完整CLI交互记录

PS D:\Flutter apps\notesapp> flutterfire configure
i Found 0 Firebase projects.
✔ Enter a project id for your new Firebase project (e.g. my-cool-project) · xnotes26657
i New Firebase project xnotes26657 created succesfully.
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase projects:create xnotes26657 --json
ERROR: Failed to add Firebase to Google Cloud Platform project. See firebase-debug.log for more info.

完整调试日志

[debug] [2022-06-02T06:28:03.862Z] ----------------------------------------------------------------------
[debug] [2022-06-02T06:28:03.868Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\Asus\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js projects:create xnotes26657 --json
[debug] [2022-06-02T06:28:03.869Z] CLI Version:   11.0.1
[debug] [2022-06-02T06:28:03.869Z] Platform:      win32
[debug] [2022-06-02T06:28:03.870Z] Node Version:  v16.15.0
[debug] [2022-06-02T06:28:03.872Z] Time:          Thu Jun 02 2022 11:28:03 GMT+0500 (Pakistan Standard Time)
[debug] [2022-06-02T06:28:03.873Z] ----------------------------------------------------------------------
[debug] 
[debug] [2022-06-02T06:28:03.890Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-06-02T06:28:03.891Z] > authorizing via signed-in user (yoosufsayyidwork@gmail.com)
[debug] [2022-06-02T06:28:03.901Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects [none]
[debug] [2022-06-02T06:28:03.902Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"projectId":"xnotes26657","name":"xnotes26657"}
[debug] [2022-06-02T06:28:05.565Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects 200
[debug] [2022-06-02T06:28:05.565Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"name":"operations/cp.7839592421547640207"}
[debug] [2022-06-02T06:28:05.567Z] >>> [apiv2][query] GET https://cloudresourcemanager.googleapis.com/v1/operations/cp.7839592421547640207 [none]
[debug] [2022-06-02T06:28:07.148Z] <<< [apiv2][status] GET https://cloudresourcemanager.googleapis.com/v1/operations/cp.7839592421547640207 200
[debug] [2022-06-02T06:28:07.148Z] <<< [apiv2][body] GET https://cloudresourcemanager.googleapis.com/v1/operations/cp.7839592421547640207 {"name":"operations/cp.7839592421547640207"}
[debug] [2022-06-02T06:28:07.662Z] [Project Creation Poller] Retrying task index 0
[debug] [2022-06-02T06:28:07.664Z] >>> [apiv2][query] GET https://cloudresourcemanager.googleapis.com/v1/operations/cp.7839592421547640207 [none]
[debug] [2022-06-02T06:28:09.260Z] <<< [apiv2][status] GET https://cloudresourcemanager.googleapis.com/v1/operations/cp.7839592421547640207 200
[debug] [2022-06-02T06:28:09.260Z] <<< [apiv2][body] GET https://cloudresourcemanager.googleapis.com/v1/operations/cp.7839592421547640207 {"name":"operations/cp.7839592421547640207","metadata":{"@type":"type.googleapis.com/google.cloudresourcemanager.v1.ProjectCreationStatus","gettable":true,"ready":true},"done":true,"response":{"@type":"type.googleapis.com/google.cloudresourcemanager.v1.Project","projectNumber":"658074243279","projectId":"xnotes26657","lifecycleState":"ACTIVE","name":"xnotes26657","createTime":"2022-06-02T06:28:04.010Z"}}
[debug] [2022-06-02T06:28:09.262Z] >>> [apiv2][query] POST https://firebase.googleapis.com/v1beta1/projects/xnotes26657:addFirebase [none]
[debug] [2022-06-02T06:28:10.130Z] <<< [apiv2][status] POST https://firebase.googleapis.com/v1beta1/projects/xnotes26657:addFirebase 403
[debug] [2022-06-02T06:28:10.130Z] <<< [apiv2][body] POST https://firebase.googleapis.com/v1beta1/projects/xnotes26657:addFirebase {"error":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED"}}
[debug] [2022-06-02T06:28:10.132Z] HTTP Error: 403, The caller does not have permission
[debug] [2022-06-02T06:28:10.291Z] FirebaseError: HTTP Error: 403, The caller does not have permission
    at module.exports (C:\Users\Asus\AppData\Roaming\npm\node_modules\firebase-tools\lib\responseToError.js:47:12)
    at RetryOperation._fn (C:\Users\Asus\AppData\Roaming\npm\node_modules\firebase-tools\lib\apiv2.js:286:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[error] 
[error] Error: Failed to add Firebase to Google Cloud Platform project. See firebase-debug.log for more info.
排查解决步骤
  • 补全Firebase侧的服务协议确认
    这是最高发的踩坑点:GCP和Firebase的服务授权体系相互独立,仅同意GCP服务条款不会自动开通Firebase服务操作权限。用当前操作的同一个谷歌账号登录Firebase控制台,跟着页面引导走完初始授权流程,把Firebase服务条款、数据处理协议全部勾选同意,进到控制台主页面即可,不需要提前手动创建项目。
  • 清除CLI本地旧登录缓存
    本地存储的登录态很容易出现权限scope缺失、缓存过期的问题,依次执行以下命令重置登录态:
    firebase logout
    firebase login --reauth
    
    弹出浏览器授权页时,所有申请的权限都要勾选,不要手动取消任何选项,否则还是会出现接口调用权限不足的问题,授权完成后回到终端即可。
  • 处理已创建的残留GCP项目
    之前执行命令时GCP项目xnotes26657已经创建成功,不需要重复创建,二选一处理即可:
    • 直接打开Firebase控制台,选择添加项目,从现有GCP项目列表中找到xnotes26657,跟着引导把它关联成Firebase项目,关联完成后回到Flutter项目目录执行flutterfire configure,选择该已有项目完成配置即可,不要选新建项目选项。
    • 如果不想手动关联,就去GCP控制台把xnotes26657项目删除(可跳过7天等待期直接强制删除),等完成Firebase条款同意、CLI重新登录两个步骤后,再重新执行flutterfire configure新建项目。
  • 兜底修复CLI版本兼容问题
    当前使用的firebase-tools 11.0.1版本存在已知的新建项目权限校验bug,前面步骤都试完还是报错的话,直接执行命令升级到最新稳定版:
    npm install -g firebase-tools@latest
    
    升级完成后重新执行配置命令即可。

内容的提问来源于stack exchange,提问作者dunker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.03 02:18:15