kai-jar

Gmail OAuth Setup

开发编程v1.0.0
作者:kai-jar更新于 2026-05-11gmail-oauth@clawhub_kai-jar/gmail-oauth
脚本工具#Gmail

据 AlphaMoat 统计,截至 2026-10,Gmail OAuth Setup 累计下载 7,094 次、获 7 个星标,按累计下载量在本次参与排名的 10,914 个 AI 技能中排名第 3,974 位,在「开发编程」分类(1,069 个)中排名第 330 位。

列表默认按累计下载量排序,也可按星标排序;详情页排名按累计下载量计算。

累计下载
7,094
星标
7
全站下载量排名
#3,974
全站前 37% · 「开发编程」前 31%
平台累计下载星标评论
ClawHub ↗6,1257-
SkillHub ↗7,0947—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

需要 gog、Google Cloud 桌面应用 OAuth 客户端及已启用的 Gmail API。用户打开授权链接后返回短效代码交换凭据,重定向 URI 必须一致。指南涵盖密钥环、账号与权限范围检查、测试模式限制和代码过期错误;不应将令牌寿命或警告页安全性当作保证。

资料发布于 2026-10-27

可以用来做什么

  • 准备或排查手动 Gmail OAuth 连接

什么时候用

  • 无图形界面的 gog 环境需要完成 Gmail 授权时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

核对客户端、权限范围和重定向设置,再说明用户授权与代码交换步骤,不展示秘密。

月度数据趋势

累计下载7,094
3,4635,4137,3632026-03 · 累计下载 3,7322026-05 · 累计下载 4,6502026-06 · 累计下载 4,8672026-07 · 累计下载 5,4372026-08 · 累计下载 5,7532026-09 · 累计下载 5,9232026-10 · 累计下载 7,09426-0326-0926-10
星标7
6782026-03 · 星标 72026-05 · 星标 72026-06 · 星标 72026-07 · 星标 72026-08 · 星标 72026-09 · 星标 72026-10 · 星标 726-0326-0926-10

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-107,094—7
2026-095,923—7
2026-085,753+5.8%7
2026-075,437+11.7%7
2026-064,867+4.7%7
2026-054,650—7
2026-033,732—7

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

4.8 KB · ClawHub v1.0.0
---
name: gmail-oauth
description: Set up Gmail API access via gog CLI with manual OAuth flow. Use when setting up Gmail integration, renewing expired OAuth tokens, or troubleshooting Gmail authentication on headless servers.
---

# Gmail OAuth Setup

Headless-friendly OAuth flow for Gmail API access using `gog` CLI.

## Prerequisites
展开全部(共 155 行)

- `gog` CLI installed (`brew install steipete/tap/gogcli`)
- Google Cloud project with OAuth credentials (Desktop app type)
- Gmail API enabled in the project

## Quick Setup

### 1. Create Google Cloud Project & Credentials

1. Go to https://console.cloud.google.com
2. Create a new project (or select existing)
3. **Enable Gmail API**: APIs & Services → Library → search "Gmail API" → Enable
4. **Configure OAuth consent screen**: APIs & Services → OAuth consent screen
   - Choose "External" user type
   - Fill in app name, user support email
   - Add scopes: `gmail.modify` (or others as needed)
   - **Important**: Click "PUBLISH APP" for permanent tokens (see Troubleshooting)
5. **Create credentials**: APIs & Services → Credentials → Create Credentials → OAuth client ID
   - Application type: **Desktop app**
   - Download the JSON file

### 2. Configure gog

```bash
gog auth credentials /path/to/client_secret.json
gog auth keyring file  # Use file-based keyring for headless
export GOG_KEYRING_PASSWORD="your-password"  # Add to .bashrc
```

### 3. Run Auth Flow

Run `scripts/gmail-auth.sh` interactively, or:

```bash
# Generate URL
scripts/gmail-auth.sh --url

# User opens URL, approves, copies code from localhost redirect
# Exchange code (do this quickly - codes expire in minutes!)
scripts/gmail-auth.sh --exchange CODE EMAIL
```

### 4. Verify

```bash
gog gmail search 'is:unread' --max 5 --account [email protected]
```

## Troubleshooting

### "Access blocked: [app] has not completed the Google verification process"

**Cause**: App is in "Testing" mode and the Gmail account isn't a test user.

**Solutions** (choose one):
1. **Publish the app** (recommended):
   - Google Cloud Console → APIs & Services → OAuth consent screen
   - Click **"PUBLISH APP"** → Confirm
   - No Google review needed for personal use
   - Tokens become permanent

2. **Add test user**:
   - OAuth consent screen → Test users → + ADD USERS
   - Add the Gmail address you're authorizing
   - Tokens still expire in 7 days

### "Google hasn't verified this app" warning screen

**This is normal for personal apps.** Click:
1. **Advanced** (bottom left)
2. **Go to [app name] (unsafe)**

Safe to proceed since you own the app.

### Token expires in 7 days

**Cause**: App is in "Testing" mode.

**Fix**: Publish the app (see above). Published apps get permanent refresh tokens.

### "invalid_request" or "invalid_grant" errors

**Causes**:
- Authorization code expired (they only last a few minutes)
- Code was already used
- Redirect URI mismatch

**Fix**: Generate a fresh auth URL and complete the flow quickly. Paste the code immediately after getting it.

### "redirect_uri_mismatch" error

**Cause**: The redirect URI in the token exchange doesn't match what was used in the auth URL.

**Fix**: This script uses `http://localhost`. Make sure both the auth URL and exchange use the same redirect URI.

### Page hangs after approving permissions (mobile)

**Cause**: Browser trying to connect to localhost which doesn't exist on phone.

**Fix**: 
- Use a desktop browser instead
- Or tap the address bar while it's "hanging" - the URL contains the code
- The URL will look like: `http://localhost/?code=4/0ABC...`

### Multiple permission checkboxes causing hangs

**Cause**: Too many OAuth scopes requested.

**Fix**: Use minimal scopes. `gmail.modify` alone is usually sufficient and shows just one permission.

### Can't find project in Google Cloud Console

**Cause**: Signed into wrong Google account.

**Fix**: Check which account owns the project:
- Click profile icon (top right)
- Switch accounts
- Check project dropdown for each account

### "invalid_request" with oob redirect (new projects)

**Cause**: Google deprecated `urn:ietf:wg:oauth:2.0:oob` for OAuth clients created after 2022.

**Fix**: Use `http://localhost` redirect instead (this script's default). After approval, browser redirects to localhost with code in URL.

## Scopes Reference

| Scope | Access |
|-------|--------|
| `gmail.modify` | Read, send, delete, manage labels (recommended) |
| `gmail.readonly` | Read only |
| `gmail.send` | Send only |
| `gmail.compose` | Create drafts, send |

## Files

- `scripts/gmail-auth.sh` — Interactive auth helper

## Tips

- **Publish your app** — Avoids test user limits and 7-day token expiry
- **Exchange codes quickly** — They expire in minutes
- **Use desktop browser** — Mobile browsers can be finicky with localhost redirects
- **One scope is enough** — `gmail.modify` covers most use cases

「开发编程」分类下的热门技能

编程大神.Skill开发编程

【全栈能力】编程大神.Skill:面向复杂真实项目的高阶全栈编程助手。不止生成代码,而是从一句目标接手陌生代码库,拆解需求、补齐实现、追到根因、完成重构、联调前后端,并把结果推进到能运行、能验证、能交付。覆盖 Web、后端、脚本、iOS、安卓、鸿蒙 ArkUI、微信小程序及其他技术栈,支持中英文工程、疑难 Bug、跨模块任务和长任务续做;用构建、日志、真实入口、设备或接口证据说明结果。仅问概念时直接回答,要求落地时持续推进到验收或明确阻塞。

↓ 1125.9万★ 82u_42bbb65f
编程专家Pro.Skill开发编程

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 626.9万★ 32user_47d655f0
编程专家.Skill开发编程

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 600.7万★ 378user_741dc82b
dev-expert开发编程

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 528.1万★ 32user_814dbe54
dev-expert-pro开发编程

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 104.7万★ -user_814dbe54
编程专家 Pro开发编程

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 98.2万★ 1user_28275a78
编程专家.Skill开发编程

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 70.1万★ 6user_613b33ea
Github开发编程

用 gh 命令行工具查看 GitHub 上的 PR 检查、工作流运行与 API 查询的技能。

↓ 48.0万★ 714Peter Steinberger

数据月份:2026-10 · 下载/星标数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。