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

Firebase升级至Google Identity Platform后,如何启用匿名用户自动清理?

启用Cloud Identity Platform匿名用户自动清理功能的步骤

由于项目升级到Google Cloud Identity Platform后,该自动清理功能暂不支持通过GCP或Firebase控制台直接启用,需要通过gcloud CLI或REST API来配置,具体操作如下:

方式一:使用gcloud命令行工具

  • 先确保你已安装并初始化Google Cloud SDK,且已登录到目标项目
  • 执行以下命令启用自动清理(替换[PROJECT_ID]为你的项目ID,30d为自动清理的天数,可按需修改,比如7d、90d):
    gcloud identity-platform projects update-config [PROJECT_ID] \
      --enable-anonymous-user-auto-cleanup \
      --anonymous-user-auto-cleanup-duration=30d
    
  • 验证配置是否生效:
    gcloud identity-platform projects describe-config [PROJECT_ID]
    
    查看输出里的anonymousUserAutoCleanupConfig字段,确认enable为true即可。

方式二:使用REST API

  • 发送PATCH请求到以下地址:
    https://identitytoolkit.googleapis.com/admin/v2/projects/[PROJECT_ID]/config
  • 请求体示例(expireAfterDays为清理天数,可修改):
    {
      "anonymousUserAutoCleanupConfig": {
        "enable": true,
        "expireAfterDays": 30
      }
    }
    
  • 请求需携带有效的身份认证令牌(可通过gcloud auth print-identity-token获取)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.01 23:35:20