Auth0 Token Vault CLI
Use the auth0-tv command-line tool to access third-party services on behalf of
authenticated users via Auth0 Token Vault.
Current status
- - Auth status: ! INLINECODE1
When to use this skill
- - The user asks to read, search, send, reply, forward, archive, or delete emails
- The user wants to manage email drafts or labels
- The user wants to connect or disconnect a third-party service (Gmail, etc.)
- The user asks about their authentication or connection status
Key patterns
Always use --json mode
All commands must use --json for structured output:
CODEBLOCK0
Alternatively, set AUTH0_TV_OUTPUT=json in the environment to avoid passing --json on every call.
Destructive actions require --confirm
Commands that modify data (send, delete, archive, forward, reply, draft send, draft delete) require --confirm:
CODEBLOCK1
Exit codes and recovery
| Code | Meaning | Recovery action |
|---|
| 0 | Success | Parse JSON output |
| 1 |
General error | Report error to user |
| 2 | Invalid input | Check command syntax and required flags |
| 3 | Auth required | Tell the user to run
auth0-tv login |
| 4 | Connection required | Tell the user to run
auth0-tv connect <service> |
| 5 | Service error | Retry or report upstream API failure |
| 6 | Network error | Check connectivity, retry |
Important: Exit codes 3 and 4 require human intervention — login and connect open a browser for OAuth. Do not attempt to run these commands autonomously; instead, tell the user what to run.
Body input for email composition
For send, reply, and draft create, the message body can be provided via:
- -
--body "inline text" — short messages - INLINECODE14 — longer messages from a file
- stdin: INLINECODE15
Prefer --body-file or stdin for messages containing special characters.
Available commands
Authentication & setup
- -
auth0-tv login — authenticate via browser (human-in-the-loop) - INLINECODE18 — clear stored credentials
- INLINECODE19 — show current user and connected services
- INLINECODE20 — connect a service via browser (human-in-the-loop)
- INLINECODE21 — disconnect a service
- INLINECODE22 — list connected services
Gmail
- -
auth0-tv gmail search <query> — search messages (supports Gmail search syntax) - INLINECODE24 — read a message
- INLINECODE25 — send a new message (destructive)
- INLINECODE26 — reply to a message (destructive)
- INLINECODE27 — forward a message (destructive)
- INLINECODE28 — archive a message (destructive)
- INLINECODE29 — move to trash (destructive)
- INLINECODE30 — list labels
- INLINECODE31 — add/remove labels
- INLINECODE32 — create a draft
- INLINECODE33 — list drafts
- INLINECODE34 — send a draft (destructive)
- INLINECODE35 — delete a draft (destructive)
See references/commands.md for full command reference with flags and JSON output examples.
Auth0 Token Vault CLI
使用 auth0-tv 命令行工具,通过 Auth0 Token Vault 代表已认证用户访问第三方服务。
当前状态
- - 认证状态:!auth0-tv --json status 2>/dev/null || echo {error:{code:not_configured,message:auth0-tv 未配置或未登录}}
何时使用此技能
- - 用户要求读取、搜索、发送、回复、转发、归档或删除电子邮件
- 用户想要管理电子邮件草稿或标签
- 用户想要连接或断开第三方服务(Gmail 等)
- 用户询问其认证或连接状态
关键模式
始终使用 --json 模式
所有命令必须使用 --json 以获得结构化输出:
bash
auth0-tv --json
或者,在环境中设置 AUTH0TVOUTPUT=json,以避免每次调用时都传递 --json。
破坏性操作需要 --confirm
修改数据的命令(发送、删除、归档、转发、回复、发送草稿、删除草稿)需要 --confirm:
bash
auth0-tv --json --confirm gmail send --to user@example.com --subject 主题 --body 正文
退出代码和恢复
一般错误 | 向用户报告错误 |
| 2 | 无效输入 | 检查命令语法和必需标志 |
| 3 | 需要认证 | 告知用户运行 auth0-tv login |
| 4 | 需要连接 | 告知用户运行 auth0-tv connect
|
| 5 | 服务错误 | 重试或报告上游 API 故障 |
| 6 | 网络错误 | 检查连接,重试 |
重要: 退出代码 3 和 4 需要人工干预 — login 和 connect 会打开浏览器进行 OAuth。不要尝试自主运行这些命令;而是告知用户应运行什么。
邮件正文输入
对于 send、reply 和 draft create,消息正文可以通过以下方式提供:
- - --body 内联文本 — 短消息
- --body-file ./message.txt — 来自文件的长消息
- 标准输入:echo 正文 | auth0-tv --json --confirm gmail send --to ... --subject ...
对于包含特殊字符的消息,推荐使用 --body-file 或标准输入。
可用命令
认证与设置
- - auth0-tv login — 通过浏览器进行认证(人工参与)
- auth0-tv logout — 清除存储的凭据
- auth0-tv status — 显示当前用户和已连接的服务
- auth0-tv connect — 通过浏览器连接服务(人工参与)
- auth0-tv disconnect — 断开服务连接
- auth0-tv connections — 列出已连接的服务
Gmail
- - auth0-tv gmail search — 搜索消息(支持 Gmail 搜索语法)
- auth0-tv gmail read — 读取消息
- auth0-tv gmail send — 发送新消息(破坏性操作)
- auth0-tv gmail reply — 回复消息(破坏性操作)
- auth0-tv gmail forward — 转发消息(破坏性操作)
- auth0-tv gmail archive — 归档消息(破坏性操作)
- auth0-tv gmail delete — 移至回收站(破坏性操作)
- auth0-tv gmail labels — 列出标签
- auth0-tv gmail label — 添加/删除标签
- auth0-tv gmail draft create — 创建草稿
- auth0-tv gmail draft list — 列出草稿
- auth0-tv gmail draft send — 发送草稿(破坏性操作)
- auth0-tv gmail draft delete — 删除草稿(破坏性操作)
有关包含标志和 JSON 输出示例的完整命令参考,请参见 references/commands.md。