User-Delegated OAuth API Access
简介
User-Delegated OAuth API Access
原始描述
Let agents request OAuth access from end users via short links, continue working asynchronously, and later claim reusable third-party API tokens from local k...
通过你的 Agent 添加
安装目录:clawauth/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: clawauth
description: Let agents request OAuth access from end users via short links, continue working asynchronously, and later claim reusable third-party API tokens from local keychain storage instead of a centralized SaaS token vault.
metadata: {"openclaw":{"emoji":"🔐","homepage":"https://auth.clawauth.app","requires":{"bins":["clawauth"]},"install":[{"id":"node","kind":"node","package":"clawauth","bins":["clawauth"],"label":"Install clawauth CLI (node)"}]}}
Clawauth OAuth Skill
This skill gives agents a production-safe OAuth handover flow that is async by default and works across chat/session interruptions.
Use this when the agent needs provider credentials from a human user, but must avoid blocking execution and must avoid long-lived token storage on a third-party auth SaaS.
Why this exists
Most "OAuth gateway" patterns keep user refresh tokens in a central hosted database. clawauth avoids that model:
- Hosted edge service mints short-lived auth sessions.
- User authorizes directly with the provider.
- Token response is encrypted end-to-end to the requesting CLI session.
- CLI claims once and stores token locally in system keychain.
- Server-side session is ephemeral and deleted on claim/expiry.
Result: async UX for agents, minimal operator overhead, and no permanent central token vault by design.
Runtime prerequisite
clawauth must already be preinstalled in the trusted runtime image/environment by the operator.
This skill does not instruct dynamic package installation.
OpenClaw can detect this requirement from frontmatter metadata:
metadata.openclaw.requires.bins: ["clawauth"]gates eligibility.metadata.openclaw.installcan expose an operator-approved install action in OpenClaw UI/Gateway flows.
How installation is documented and triggered
- Installation intent is declared in frontmatter, not in free-form shell instructions.
- This skill declares a Node installer in
metadata.openclaw.install for package clawauth.
- OpenClaw/Gateway uses that metadata to offer a managed install action when
clawauth is missing.
- If multiple installer options are present, Gateway selects a preferred one (OpenClaw docs: brew preferred when available, otherwise node manager policy).
- For this skill we publish a single Node installer path to keep behavior deterministic across hosts.
- Reference: https://docs.openclaw.ai/tools/skills
- Reference: https://docs.openclaw.ai/platforms/mac/skills
Manual install (operator fallback)
metadata.openclaw.install for package clawauth.clawauth is missing.If OpenClaw/Gateway does not run the install action automatically, install the CLI manually:
npm i -g clawauth
Then verify:
clawauth --help
openclaw skills check --json
Install policy (recommended)
- Pre-install
clawauth in the base image/runner and disable ad-hoc package fetches.
- Pin and approve the CLI version in operator-managed tooling policy.
- Keep package source/provenance controls outside this skill (CI image build or internal artifact policy).
Hosted service endpoint
clawauth in the base image/runner and disable ad-hoc package fetches.The published CLI is already wired to:
https://auth.clawauth.app
Agents do not need CLAWAUTH_WORKER_URL for normal hosted usage.
Provider support
Implemented providers in current worker:
- notion
- github
- discord
- linear
- airtable
- todoist
- asana
- trello
- dropbox
- digitalocean
- slack
- gitlab
- figma
- spotify
- bitbucket
- box
- calendly
- fathom
- twitch
Always treat server output as source of truth:
clawauth providers --json
Canonical async flow (non-blocking)
- Start auth and return immediately:
clawauth login start <provider> --json
-
Extract and forward shortAuthUrl to the user.
-
Continue other work. Do not block.
-
Later poll/check:
clawauth login status <sessionId> --json
- When status is
completed, claim once:
clawauth login claim <sessionId> --json
- Claim completion and hand off control to the operator-defined API call layer.
This skill intentionally avoids instructing raw token materialization commands.
Token exposure boundaries
login claim may return sensitive token payload data in JSON output.
- Do not paste sensitive command output to chat, logs, traces, or telemetry.
- Do not materialize tokens into shell environments from this skill.
- Use operator-controlled secret handling for downstream provider API calls.
Command map
Login lifecycle
clawauth login start [provider] [--ttl <seconds>] [--scope <scope>] [--json]
clawauth login status <sessionId> [--json]
clawauth login claim <sessionId> [--json]
clawauth login wait <sessionId> [--timeout <ms>] [--interval <ms>] [--json]
Session management
clawauth sessions [--json]
clawauth session-rm <sessionId> [--json]
Token access
clawauth login start <provider> --json
Extract and forward shortAuthUrl to the user.
Continue other work. Do not block.
Later poll/check:
clawauth login status <sessionId> --json
completed, claim once:clawauth login claim <sessionId> --json
login claimmay return sensitive token payload data in JSON output.- Do not paste sensitive command output to chat, logs, traces, or telemetry.
- Do not materialize tokens into shell environments from this skill.
- Use operator-controlled secret handling for downstream provider API calls.
Command map
Login lifecycle
clawauth login start [provider] [--ttl <seconds>] [--scope <scope>] [--json]clawauth login status <sessionId> [--json]clawauth login claim <sessionId> [--json]clawauth login wait <sessionId> [--timeout <ms>] [--interval <ms>] [--json]
Session management
clawauth sessions [--json]clawauth session-rm <sessionId> [--json]clawauth token list [--json]
Discovery and docs
clawauth providers [--json]
clawauth explain
clawauth docs
JSON fields agents should parse
login start --json
provider
sessionId
expiresIn
shortAuthUrl
authUrl
statusCommand
claimCommand
login status --json
status (pending | completed | error)
provider
error
login claim --json
status (pending | completed | error)
provider
tokenData
storedInKeychain
keychainService
keychainAccount
Agent behavior rules
- Prefer
--json for machine parsing.
- Never block by default; only use
login wait when explicitly needed.
- On
pending: schedule retry later.
- On
completed: run login claim once.
- On
error: surface concise reason and restart with new login start.
- If session context is lost, recover using
clawauth sessions --json.
- If provider unknown, run
clawauth providers --json and choose supported value.
- Never print raw tokens into user-facing chat.
- Do not run package install/fetch commands from this skill.
- Do not export tokens into shell environment variables from this skill.
Security model summary
- Short-lived session data in Cloudflare KV (default TTL: 3600s, configurable).
- Signed OAuth
state binding provider and expiry.
- Signed request verification for status/claim with timestamp + nonce.
- Replay and rate-limit protections during polling.
- End-to-end encrypted token blob (
nacl.box) from callback to CLI claimant.
- Session blob removed from server on successful claim.
- Tokens stored locally in OS keychain via CLI.
Failure handling
clawauth providers [--json]clawauth explainclawauth docslogin start --json
providersessionIdexpiresInshortAuthUrlauthUrlstatusCommandclaimCommandlogin status --json
status(pending | completed | error)providererror
login claim --json
status (pending | completed | error)
provider
tokenData
storedInKeychain
keychainService
keychainAccount
Agent behavior rules
- Prefer
--json for machine parsing.
- Never block by default; only use
login wait when explicitly needed.
- On
pending: schedule retry later.
- On
completed: run login claim once.
- On
error: surface concise reason and restart with new login start.
- If session context is lost, recover using
clawauth sessions --json.
- If provider unknown, run
clawauth providers --json and choose supported value.
- Never print raw tokens into user-facing chat.
- Do not run package install/fetch commands from this skill.
- Do not export tokens into shell environment variables from this skill.
Security model summary
- Short-lived session data in Cloudflare KV (default TTL: 3600s, configurable).
- Signed OAuth
state binding provider and expiry.
- Signed request verification for status/claim with timestamp + nonce.
- Replay and rate-limit protections during polling.
- End-to-end encrypted token blob (
nacl.box) from callback to CLI claimant.
- Session blob removed from server on successful claim.
- Tokens stored locally in OS keychain via CLI.
Failure handling
status (pending | completed | error)providertokenDatastoredInKeychainkeychainServicekeychainAccount- Prefer
--jsonfor machine parsing. - Never block by default; only use
login waitwhen explicitly needed. - On
pending: schedule retry later. - On
completed: runlogin claimonce. - On
error: surface concise reason and restart with newlogin start. - If session context is lost, recover using
clawauth sessions --json. - If provider unknown, run
clawauth providers --jsonand choose supported value. - Never print raw tokens into user-facing chat.
- Do not run package install/fetch commands from this skill.
- Do not export tokens into shell environment variables from this skill.
Security model summary
- Short-lived session data in Cloudflare KV (default TTL: 3600s, configurable).
- Signed OAuth
state binding provider and expiry.
- Signed request verification for status/claim with timestamp + nonce.
- Replay and rate-limit protections during polling.
- End-to-end encrypted token blob (
nacl.box) from callback to CLI claimant.
- Session blob removed from server on successful claim.
- Tokens stored locally in OS keychain via CLI.
Failure handling
state binding provider and expiry.nacl.box) from callback to CLI claimant.Provider not implemented:
login startreturns error indicating feature request recorded.
Provider misconfigured on backend:
- server returns clear missing secret/config message.
Session expired:
status/claimreturns not found/expired; start new session.
Lost chat context:
- run
clawauth sessions --json, then continue withstatus/claim.
No token found later:
- run
clawauth token list --jsonand select provider/account explicitly.
Minimal end-to-end example
# 1) Start
clawauth login start notion --json
# 2) Share shortAuthUrl with user (from JSON output)
# 3) Later check
clawauth login status <sessionId> --json
# 4) Claim when completed
clawauth login claim <sessionId> --json
# 5) Continue with operator-defined downstream API handling
Reference
# 1) Start
clawauth login start notion --json
# 2) Share shortAuthUrl with user (from JSON output)
# 3) Later check
clawauth login status <sessionId> --json
# 4) Claim when completed
clawauth login claim <sessionId> --json
# 5) Continue with operator-defined downstream API handling
See references/commands.md for compact copy-paste command blocks.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。