TapAuth — OAuth Tokens via OpenClaw Secrets Manager
TapAuth provides OAuth tokens through OpenClaw's exec secrets provider. Tokens are resolved at gateway startup and held in memory — they never appear in shell commands or config files as plaintext.
You must NEVER use tapauth.sh --token directly in shell commands, curl calls, or $(...) substitutions. Tokens are always resolved through the secrets manager. Your job as an agent is to configure the secrets provider, not to fetch tokens yourself.
When a user asks you to do something that needs an OAuth token
Follow these steps in order. Do not skip to step 3. Do not run --token yourself.
1. Create a grant and show the approval URL
Run the script without --token to create a grant. Set TAPAUTH_HOME so the grant cache is stored in a stable location that the exec provider can also find:
CODEBLOCK0
Example for Google Calendar:
CODEBLOCK1
Output:
CODEBLOCK2
Show the approval URL to the user and ask them to approve. Wait for them to confirm before proceeding.
2. Configure the exec secrets provider in openclaw.json
After the user confirms they approved, edit ~/.openclaw/openclaw.json to add an exec provider under secrets.providers:
CODEBLOCK3
Key fields:
- -
command: Absolute path to scripts/tapauth.sh in this skill directory args: ["--token", "<provider>", "<scopes>"] — must match the grant you created in step 1jsonOnly: false: The script outputs a raw token string, not JSONpassEnv: Must include INLINECODE13env.TAPAUTH_HOME: Must be /home/node/.tapauth — the same path used when creating the grant in step 1
Use the naming convention tapauth_<provider> or tapauth_<provider>_<scope> for the provider key.
3. Reload secrets and confirm
After editing openclaw.json, run:
CODEBLOCK4
This tells the gateway to re-resolve all secret providers. The exec provider runs tapauth.sh --token in the background and stores the result in the in-memory secrets snapshot.
Tell the user the setup is complete. The token is now resolved and will be available at every gateway startup. If the user repeats their request in a new session, the token will already be available.
One-time verification (optional): Since the grant is now approved and cached, you may run the script once to verify and fulfill the user's immediate request:
CODEBLOCK5
After this, all future token access must come from the secrets manager via SecretRef — do not use --token directly again.
Rules
- - NEVER run
tapauth.sh --token directly. Do not use it in $(...), do not capture its output, do not pipe it to curl. The secrets manager runs it for you. - NEVER skip the approval step. Always create the grant first (step 1), get user approval, then configure the provider (step 2).
- No API key or credentials needed. TapAuth is zero-config. Do not look for API keys, client secrets, or environment variables.
- Always use absolute paths for the
command field in the exec provider config.
Quick Reference — Provider + Scopes
| Provider | Args for exec provider | Scopes Reference |
|---|
| Google Calendar | INLINECODE24 | INLINECODE25 |
| Google Drive |
["--token", "google", "drive.readonly"] |
references/google.md |
| Google Sheets |
["--token", "google", "spreadsheets.readonly"] |
references/google.md |
| Gmail |
["--token", "google", "gmail.send"] |
references/gmail.md |
| GitHub |
["--token", "github", "repo"] |
references/github.md |
| Vercel |
["--token", "vercel", "deployment"] |
references/vercel.md |
| Notion |
["--token", "notion", "read_content"] |
references/notion.md |
| Slack |
["--token", "slack", "users:read"] |
references/slack.md |
| Asana |
["--token", "asana", "tasks:read"] |
references/asana.md |
| Linear |
["--token", "linear", "read"] |
references/linear.md |
| Sentry |
["--token", "sentry", "project:read"] |
references/sentry.md |
| Discord |
["--token", "discord", "identify"] |
references/discord.md |
| Apify |
["--token", "apify", "full_api_access"] |
references/apify.md |
Multiple scopes: comma-separate in a single string, e.g. ["--token", "google", "calendar.readonly,drive.readonly"].
Token Lifecycle
- - Resolution: Fresh tokens fetched at each gateway startup and
openclaw secrets reload. - Caching:
tapauth.sh caches tokens locally with expiry. Subsequent calls return instantly if valid. - Refresh: Expired tokens are refreshed automatically from the TapAuth API. No user interaction needed.
- Re-approval: If a grant is revoked, delete
~/.tapauth/<provider>-<scopes>.env and re-run scripts/tapauth.sh to create a new grant.
Troubleshooting
| Symptom | Cause | Fix |
|---|
| INLINECODE55 | Grant revoked or expired | Delete ~/.tapauth/<provider>-<scopes>.env, re-run INLINECODE57 |
| Token works locally but not in OpenClaw |
passEnv missing
HOME | Add
HOME to
passEnv array |
|
command must be absolute path | Relative path in
command | Resolve
scripts/tapauth.sh to its absolute path |
| Symlink error | Skill installed via symlink | Add
allowSymlinkCommand: true and
trustedDirs to provider config |
|
tapauth: timed out | Grant not pre-approved | Run
scripts/tapauth.sh <provider> <scopes> without
--token first |
TapAuth — 通过 OpenClaw 密钥管理器获取 OAuth 令牌
TapAuth 通过 OpenClaw 的 exec 密钥提供程序提供 OAuth 令牌。令牌在网关启动时解析并保存在内存中——它们永远不会以明文形式出现在 shell 命令或配置文件中。
你绝不能直接在 shell 命令、curl 调用或 $(...) 替换中使用 tapauth.sh --token。 令牌始终通过密钥管理器解析。你作为代理的工作是配置密钥提供程序,而不是自己获取令牌。
当用户要求你执行需要 OAuth 令牌的操作时
请按顺序执行以下步骤。不要跳过步骤 3。不要自己运行 --token。
1. 创建授权并显示批准 URL
运行脚本不带 --token 来创建授权。设置 TAPAUTH_HOME,使授权缓存存储在 exec 提供程序也能找到的稳定位置:
bash
TAPAUTH_HOME=/home/node/.tapauth /home/node/.openclaw/skills/tapauth/scripts/tapauth.sh
Google Calendar 示例:
bash
TAPAUTH_HOME=/home/node/.tapauth /home/node/.openclaw/skills/tapauth/scripts/tapauth.sh google calendar.readonly
输出:
text
批准访问:https://tapauth.ai/approve/abc123
向用户显示此 URL。一旦他们批准,使用 --token 运行以获取 bearer 令牌。
向用户显示批准 URL 并请求他们批准。 等待他们确认后再继续。
2. 在 openclaw.json 中配置 exec 密钥提供程序
在用户确认批准后,编辑 ~/.openclaw/openclaw.json,在 secrets.providers 下添加 exec 提供程序:
json
{
secrets: {
providers: {
tapauthgooglecalendar: {
source: exec,
command: /home/node/.openclaw/skills/tapauth/scripts/tapauth.sh,
args: [--token, google, calendar.readonly],
passEnv: [HOME],
env: {TAPAUTH_HOME: /home/node/.tapauth},
jsonOnly: false
}
}
}
}
关键字段:
- - command:此技能目录中 scripts/tapauth.sh 的绝对路径
- args:[--token, , ] — 必须与你在步骤 1 中创建的授权匹配
- jsonOnly: false:脚本输出原始令牌字符串,而非 JSON
- passEnv:必须包含 HOME
- env.TAPAUTH_HOME:必须为 /home/node/.tapauth — 与步骤 1 中创建授权时使用的路径相同
对于提供程序键,使用命名约定 tapauth 或 tapauth_。
3. 重新加载密钥并确认
编辑 openclaw.json 后,运行:
bash
openclaw secrets reload
这会告诉网关重新解析所有密钥提供程序。exec 提供程序在后台运行 tapauth.sh --token,并将结果存储在内存中的密钥快照中。
告诉用户设置已完成。 令牌现已解析,并将在每次网关启动时可用。如果用户在新会话中重复其请求,令牌将已可用。
一次性验证(可选): 由于授权现已批准并缓存,你可以运行一次脚本以验证并满足用户的即时请求:
bash
TAPAUTH_HOME=/home/node/.tapauth /home/node/.openclaw/skills/tapauth/scripts/tapauth.sh --token
此后,所有未来的令牌访问必须通过 SecretRef 来自密钥管理器——不要再直接使用 --token。
规则
- - 绝不要直接运行 tapauth.sh --token。 不要在 $(...) 中使用它,不要捕获其输出,不要将其管道传输到 curl。密钥管理器会为你运行它。
- 绝不要跳过批准步骤。 始终先创建授权(步骤 1),获取用户批准,然后配置提供程序(步骤 2)。
- 无需 API 密钥或凭据。 TapAuth 是零配置的。不要寻找 API 密钥、客户端密钥或环境变量。
- 始终在 exec 提供程序配置的 command 字段中使用绝对路径。
快速参考 — 提供程序 + 作用域
| 提供程序 | exec 提供程序的参数 | 作用域参考 |
|---|
| Google Calendar | [--token, google, calendar.readonly] | references/google.md |
| Google Drive |
[--token, google, drive.readonly] | references/google.md |
| Google Sheets | [--token, google, spreadsheets.readonly] | references/google.md |
| Gmail | [--token, google, gmail.send] | references/gmail.md |
| GitHub | [--token, github, repo] | references/github.md |
| Vercel | [--token, vercel, deployment] | references/vercel.md |
| Notion | [--token, notion, read_content] | references/notion.md |
| Slack | [--token, slack, users:read] | references/slack.md |
| Asana | [--token, asana, tasks:read] | references/asana.md |
| Linear | [--token, linear, read] | references/linear.md |
| Sentry | [--token, sentry, project:read] | references/sentry.md |
| Discord | [--token, discord, identify] | references/discord.md |
| Apify | [--token, apify, full
apiaccess] | references/apify.md |
多个作用域:在单个字符串中用逗号分隔,例如 [--token, google, calendar.readonly,drive.readonly]。
令牌生命周期
- - 解析: 每次网关启动和 openclaw secrets reload 时获取新令牌。
- 缓存: tapauth.sh 在本地缓存令牌并带有过期时间。后续调用如果有效则立即返回。
- 刷新: 过期的令牌会自动从 TapAuth API 刷新。无需用户交互。
- 重新批准: 如果授权被撤销,删除 ~/.tapauth/-.env 并重新运行 scripts/tapauth.sh 以创建新授权。
故障排除
| 症状 | 原因 | 修复 |
|---|
| token refresh failed | 授权被撤销或过期 | 删除 ~/.tapauth/<provider>-<scopes>.env,重新运行 scripts/tapauth.sh |
| 令牌在本地有效但在 OpenClaw 中无效 |
passEnv 缺少 HOME | 将 HOME 添加到 passEnv 数组 |
| command must be absolute path | command 中使用相对路径 | 将 scripts/tapauth.sh 解析为其绝对路径 |
| 符号链接错误 | 技能通过符号链接安装 | 在提供程序配置中添加 allowSymlinkCommand: true 和 trustedDirs |
| tapauth: timed out | 授权未预先批准 | 先运行 scripts/tapauth.sh
不带 --token |