Agent skill
auth-manager
网页登录态管理。使用 fast-browser-use (fbu) 管理各平台登录状态,定期检查可用性,新平台授权时自动保存 profile。
Install this agent skill to your Project
npx add-skill https://github.com/aAAaqwq/AGI-Super-Team/tree/master/skills/auth-manager
Metadata
Additional technical details for this skill
- type
- automation
- domains
-
[ "auth", "fbu", "session-management" ] - version
- 3.1.0
SKILL.md
Auth Manager v3.1 — 平台登录态管理
基于 fast-browser-use (fbu),使用
--user-data-dir保存完整 Chrome profile(cookies + localStorage + IndexedDB)。
环境配置(必须)
fbu 二进制在 ~/.cargo/bin/,每次执行前必须设置:
export PATH="$HOME/.cargo/bin:$PATH"
export CHROME_PATH=/usr/bin/google-chrome
export DISPLAY=:1 # 桌面显示,headless false 时必须
核心职责
职责 1: 检查已保存 profile 可用性
定期对 auth-platforms.json 中所有 enabled: true 平台执行 snapshot 检查:
# 必须用 timeout 包裹,防止 Chrome 残留
timeout --kill-after=5 60 fast-browser-use snapshot \
--url "<check_url>" \
--user-data-dir ~/.openclaw/chrome-profiles/<platform> || true
pkill -f "chrome.*--remote-debugging" 2>/dev/null || true
判定逻辑:
- DOM 包含
logged_in_indicators关键词 → ✅active - DOM 包含
login_page_indicators关键词 → ❌expired - 都不匹配 → ⚠️
uncertain - 命令失败 → 🔴
error
Cloudflare 站点(如 linux.do)headless 模式会被拦截,需加 --headless false:
timeout --kill-after=5 90 fast-browser-use snapshot \
--url "https://linux.do" \
--user-data-dir ~/.openclaw/chrome-profiles/linuxdo \
--headless false || true
pkill -f "chrome.*--remote-debugging" 2>/dev/null || true
结果写入 ~/.openclaw/auth-session-state.json,过期/异常时推送告警。
职责 2: 新平台授权 — 自动保存 profile
当用户使用 fbu 授权新平台时,执行以下完整流程:
步骤 1: 创建 profile 目录
mkdir -p ~/.openclaw/chrome-profiles/<platform>
步骤 2: 打开桌面浏览器让用户登录
fast-browser-use login \
--url "https://platform.com/login" \
--headless false \
--user-data-dir ~/.openclaw/chrome-profiles/<platform> \
--save-session ~/.openclaw/chrome-profiles/<platform>-session.json
关键参数说明:
--headless false— 必须,在桌面打开可视 Chrome 窗口--save-session— 必填参数(fbu login 要求),即使主要靠 user-data-dir 保存状态--user-data-dir— 保存完整 Chrome profile- 浏览器打开后终端显示 "Press Enter after you have logged in..."
- 用户登录完成后,agent 向进程写入换行符(Enter)触发保存
步骤 3: 用户确认登录后发送 Enter
# 使用 process write 向 fbu 进程发送 Enter
process.write(sessionId, "\n")
步骤 4: 验证登录态
fast-browser-use snapshot \
--url "<check_url>" \
--user-data-dir ~/.openclaw/chrome-profiles/<platform>
检查 DOM 输出是否包含登录态关键词(用户名、余额、dashboard 等)。
步骤 5: 更新配置文件
将新平台添加到 auth-platforms.json,包括 check_url、login_url、indicators 等。
步骤 6: 更新状态文件
写入 auth-session-state.json。
文件结构
~/.openclaw/chrome-profiles/<platform>/ # fbu Chrome profile(完整状态)
~/.openclaw/auth-platforms.json # 平台配置
~/.openclaw/auth-session-state.json # 检查结果状态
平台配置格式
~/.openclaw/auth-platforms.json:
{
"platforms": {
"platform_id": {
"name": "显示名称",
"profile_dir": "~/.openclaw/chrome-profiles/platform_id",
"check_url": "https://example.com/dashboard",
"login_url": "https://example.com/login",
"logged_in_indicators": ["关键词1", "关键词2"],
"login_page_indicators": ["登录", "Sign in"],
"enabled": true,
"credentials": {
"username": "user@example.com",
"password": "xxx"
},
"login_method": "github_oauth"
}
}
}
可选字段说明
- credentials:有账密的平台可存储凭据,profile 过期时 agent 可用 fbu navigate 自动填写表单重新登录
- login_method:登录方式说明(如
github_oauth、qrcode、password),帮助 agent 判断是否能自动登录
批量检查
遍历所有 enabled 平台,用 grep 匹配关键词快速判定:
# 批量检查示例(用 grep 匹配关键词)
for platform in polymarket aixn xingjiabiapi github douyin xiaohongshu linuxdo; do
echo "=== $platform ==="
fast-browser-use snapshot \
--url "$(jq -r ".platforms.$platform.check_url" ~/.openclaw/auth-platforms.json)" \
--user-data-dir ~/.openclaw/chrome-profiles/$platform 2>&1 \
| grep -E "关键词" | head -5
done
已知平台特性
| 平台 | 登录方式 | Headless | 备注 |
|---|---|---|---|
| Polymarket | 钱包/OAuth | ✅ | 检查"资产组合"关键词 |
| AIXN (XAPI) | 账密 | ✅ | 有 credentials,可自动登录 |
| 性价比API | GitHub OAuth | ✅ | 需先有 GitHub 登录态 |
| GitHub | 账密 | ✅ | 检查 Settings 页面 |
| 抖音创作者 | 扫码 | ✅ | 必须用户手动扫码 |
| 小红书创作者 | 扫码 | ✅ | 必须用户手动扫码 |
| Linux Do | 账密/OAuth | ❌ 需 headless false | Cloudflare 拦截 headless |
| X (Twitter) | 账密 | ✅ | 可能有验证码 |
状态文件格式
~/.openclaw/auth-session-state.json:
{
"platforms": {
"polymarket": {
"status": "active",
"message": "登录正常 ✅ (发现: 资产组合 $6.02)",
"checkedAt": 1740000000
}
},
"lastCheck": 1740000000
}
status 值: active | expired | uncertain | error
Cron 任务
已配置定期自动检查(cron id: 1f2eb5a5-5c2e-4556-b006-e29325f41609),过期则推送告警。
注意事项
- fbu login 必填参数:
--url、--headless、--user-data-dir、--save-session四个缺一不可 - Profile 锁:
--user-data-dir会锁定 profile,同一 profile 不能被多个 Chrome 实例同时使用 - Cloudflare 站点:headless 被拦截时用
--headless false,但 snapshot 的--headless参数需要显式传false - OAuth 登录(GitHub OAuth 等):新 profile 里没有第三方登录态,需要用户在弹出页面登录第三方账号
- 扫码登录(抖音、小红书):必须用户手动操作,agent 无法自动完成
- snapshot 验证:新平台授权后务必 snapshot 验证一次,确认 profile 已正确保存
- 超时设置:fbu login 可能需要较长时间(用户操作),exec timeout 建议 ≥ 300s
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
model-fallback
模型自动降级与故障切换。当主模型请求失败、超时、达到速率限制或配额耗尽时,自动切换到备用模型,确保服务连续性。支持多供应商、多优先级的智能模型选择,提供健康监控、自动重试和错误恢复机制。
multimodal-gen
多模态内容生成(图片、视频)。当用户需要生成图片、生成图像、生成视频、AI绘画、AI作图、画一张图、做个视频、文生图、文生视频时使用此技能。自动调用 multimodal-agent 进行生成。
github-automation
自动化 GitHub 操作。当用户需要推送代码到 GitHub、管理仓库、创建 PR、处理 Issue、git push 失败时使用此技能。优先使用 mcporter call github.push_files 而不是 git push。
geo-agent
Automated GEO (Generative Engine Optimization) agent for boosting brand visibility in AI search engines. Manages keywords, researches real competitors, generates comparison articles with target brand prominence, auto-publishes to Chinese content platforms (Zhihu/Baijiahao/Sohu/Toutiao), monitors AI search engine indexing, and reports results. Use when: user wants GEO automation, AI search optimization, multi-platform article publishing, or brand visibility in AI answers.
token-reporter
每日自动统计 OpenClaw 实例 Token 消耗和工作产出,上报到飞书多维表格。扫描 JSONL 日志按模型聚合 token,收集各 agent 当日工作摘要,写入飞书 Bitable。触发:'token报告'、'token report'、'日报'、'每日汇报'、'飞书上报'。
feishu-doc-optimizer
飞书云文档内容优化与格式美化。当用户需要优化飞书文档的排版、结构、格式、美观度时使用此技能。支持:(1) 读取飞书文档内容 (2) 优化文档结构和层次 (3) 清空并替换文档内容 (4) 通过浏览器自动化编辑文档。触发词:优化飞书文档、美化文档、整理文档格式、文档排版。
Didn't find tool you were looking for?