Files
nexus/wiki/sources/gog-cli-安装配置指南.md
2026-04-28 12:03:10 +08:00

48 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "GOG CLI 安装配置指南"
type: source
tags: [gog, gog-cli, macos, google-workspace, oauth]
date: 2026-03-15
---
## Source File
- [[raw/Skills/GOG-CLI-安装配置指南.md]]
## Summary用中文描述
- 核心主题gog CLI 工具在 macOS 上的完整安装与配置流程
- 问题域Google WorkspaceGmail、Google Calendar、Google Drive、Google Contacts、Google Docs、Google Sheets的命令行管理
- 方法/机制:通过 Homebrew 安装 → Google Cloud Console 创建 OAuth 凭证 → 配置凭证文件 → 添加测试用户绕过 Google 安全验证 → 启用各 Google API → 验证授权
- 结论/价值:实现通过命令行高效管理 Google Workspace 全套服务,支持搜索邮件、发送邮件、管理日历、搜索 Drive 文件、操作 Sheets/Docs 等功能
## Key Claims用中文描述
- 通过 Homebrew 安装 gog CLI 是最简方式,安装路径为 /opt/homebrew/bin/gog
- Google API 调用需同时满足 OAuth 授权和 API Enablement 两层条件,缺一不可
- 对于未经 Google 验证的应用,通过在 OAuth 客户端中添加测试用户可绕过"此应用未经 Google 验证"的安全限制
- 启用新 API 服务后需重新授权revoke + login否则旧 token 不包含新权限会导致 403 错误
- 设置 GOG_ACCOUNT 环境变量可避免每次命令都需指定账号
## Key Quotes
> "此应用未经 Google 验证。此应用请求访问您 Google 账号中的敏感信息。在开发者让该应用通过 Google 验证之前,请勿使用该应用。" — 首次授权时的典型 Google 安全警告
> "即使 OAuth 成功,如果 API 未启用也会报错403 accessNotConfigured" — OAuth 与 API Enablement 的两层机制说明
> "gog auth revoke → gog auth login旧 token 不包含新权限" — 启用新 API 后的必要重新授权步骤
## Key Concepts
- [[OAuth 2.0]]Google API 的用户身份认证机制gog 通过 OAuth 让用户授权 CLI 访问其 Google 账号数据
- [[Google Cloud Console]]Google 云平台控制台,用于创建 OAuth 凭证和启用 Google API 服务
- [[Google Workspace]]Google 生产力工具套件,包含 Gmail、Google Calendar、Google Drive、Google Contacts、Google Docs、Google Sheets
- [[Homebrew]]macOS 包管理器gog CLI 通过 `brew install steipete/tap/gogcli` 安装
## Key Entities
- [[steipete]]gogcli 项目的开发者,维护 gog CLI 工具
- [[ishenwei@gmail.com]]:配置中使用的 Google 账号,通过该账号授权 gog 访问 Google Workspace
## Connections
- [[Homebrew]] ← 安装工具 ← [[GOG CLI 安装配置指南]]
- [[Google Workspace]] ← 管理对象 ← [[GOG CLI 安装配置指南]]
- [[OAuth 2.0]] ← 认证机制 ← [[GOG CLI 安装配置指南]]
- [[Google Cloud Console]] ← 配置平台 ← [[GOG CLI 安装配置指南]]
## Contradictions
- 暂无已知冲突内容