Files
nexus/wiki/concepts/API-Enablement.md
2026-04-21 16:03:27 +08:00

1.3 KiB
Raw Blame History

title, type, tags
title type tags
API Enablement concept
google-cloud
oauth
api

Definition

API Enablement 是在 Google Cloud Console 中为项目启用特定 API 服务的操作。即使 OAuth 认证成功,如果目标 API 未启用,调用时仍会返回 403 accessNotConfigured 错误。

Two-Layer Authorization Model

层级 控制内容 错误示例
OAuth 授权 用户身份认证 未授权/权限不足
API Enablement 是否允许调用 API 403 accessNotConfigured

操作步骤

  1. 进入 Google Cloud ConsoleAPIs & ServicesLibrary
  2. 搜索目标 API如 Gmail API、Calendar API
  3. 点击 Enable 启用
  4. 等待生效(通常 30 秒 ~ 2 分钟,有延迟)
  5. 重新执行 OAuth 授权(因旧 token 不包含新权限)

典型错误

Gmail API has not been used in project XXX

表示:该 Google Cloud 项目未启用 Gmail API

相关概念

相关工具

  • gog CLI:一个同时需要 OAuth + API Enablement 才能正常工作的 CLI 工具