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

Android端Firebase认证遇403 Forbidden错误,请求排查解决

Firebase Authentication 403 Forbidden错误排查与解决

问题背景

Android应用集成Firebase Authentication,此前账号创建、登录均正常,今日通过Cloudflare Warp网络登录时触发403 Forbidden错误,错误栈显示无法解析返回的HTML错误内容,核心提示为无权限访问/identitytoolkit/v3/relyingparty/verifyPassword接口。

完整错误信息:

com.google.android.gms.internal.firebase-auth-api.zzvt: Failed to parse error for string [      Error 403 (Forbidden)!!1      <em>{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}</em> > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}      <p><b>403.</b> That’s an error.  <p>Your client does not have permission to get URL <code>/identitytoolkit/v3/relyingparty/verifyPassword</code> from this server.  That’s all we know.] with exception: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject

可能原因

  • Cloudflare Warp的代理IP被Google API服务判定为异常:Warp的IP池中的部分IP可能因频繁请求、地区限制或被标记为风险IP,触发了Google的访问拦截。
  • Firebase API密钥权限变更:即便之前正常,API密钥的应用限制(如IP/包名限制)或API权限列表可能被修改,导致无法访问Auth接口。
  • 客户端Auth缓存损坏:本地存储的登录会话信息过期或损坏,导致请求验证逻辑异常。
  • 设备时间偏差:设备系统时间与实际时间偏差过大,会导致JWT Token验证失败,触发403错误。

解决步骤

  1. 排除网络代理干扰

    • 关闭Cloudflare Warp,使用原生网络测试登录。若恢复正常,说明是Warp的IP问题:尝试切换Warp节点(手动选择其他地区),或等待Warp更新IP池;也可在Warp设置中添加Firebase相关域名到白名单。
  2. 检查Firebase API密钥配置

    • 登录Firebase控制台,进入项目「设置」>「服务账号」>「API密钥」
    • 确认目标API密钥的「应用限制」未添加不合理的IP/包名限制;「API限制」中已勾选「Firebase Authentication API」。
  3. 清除应用缓存与数据

    • 在Android系统的应用设置中找到目标应用,清除缓存和存储数据,重启应用后重新尝试登录。
  4. 更新Firebase Auth SDK

    • 检查项目中Firebase Auth依赖库版本,升级至最新稳定版,避免旧版本的兼容性问题。
  5. 校准设备时间

    • 将设备时间设置为自动同步(设置>系统>日期和时间>自动设置),确保时间与网络时间一致。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 10:33:20