OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  pdauth:通过 Pipedream 为 AI 智能体实现动态 OAuth 验证

pdauth:通过 Pipedream 为 AI 智能体实现动态 OAuth 验证

 
  oauth ·  2026-02-07 11:41:30 · 3 次点击  · 0 条评论  

名称: pdauth
描述: 通过 Pipedream 为 AI 代理提供动态 OAuth 授权。为 2500+ 个 API 生成 OAuth 链接,让用户授权,然后代表他们调用 MCP 工具。
主页: https://github.com/Versatly/pdauth
元数据:
{
"openclaw":
{
"emoji": "🔐",
"requires": { "bins": ["pdauth"] },
"install":
[
{
"id": "node",
"kind": "node",
"package": "pdauth",
"bins": ["pdauth"],
"label": "安装 pdauth (node)",
},
],
},
}


pdauth — AI 代理的动态 OAuth 工具

使用 pdauth 让您(代理)通过 OAuth 访问 2500+ 个 API。流程如下:

  1. 代理需要访问某个应用(如 Spotify、Slack、Notion 等)。
  2. 使用 pdauth connect <app> 生成一个 OAuth 授权链接。
  3. 将链接分享给用户 → 用户点击并授权。
  4. 代理现在可以通过 pdauth call <app.tool> 调用工具了。

快速参考

# 配置(一次性设置)
pdauth config

# 搜索应用
pdauth apps --search spotify

# 生成 OAuth 授权链接
pdauth connect spotify --user 用户_ID

# 查看已连接的应用
pdauth status --user 用户_ID

# 列出可用工具
pdauth tools spotify --user 用户_ID

# 调用工具
pdauth call spotify.get_my_playlists --user 用户_ID
pdauth call slack.send_message channel=general text="你好!"

OAuth 授权流程(如何请求访问权限)

当您需要访问用户尚未授权的应用时:

1. 运行:pdauth connect <app> --user <用户_ID>
2. 从输出中获取 OAuth 授权链接
3. 将链接发送给用户:"要执行此操作,我需要访问 <App>。请点击此处授权:<链接>"
4. 用户点击链接,通过 Pipedream 完成授权
5. 使用 `pdauth status --user <用户_ID>` 确认授权状态
6. 现在您可以调用工具了!

用户 ID 策略

为每个用户使用一致的标识符:
- Telegram: telegram:5439689035
- 邮箱: pedro@example.com
- 自定义: pedro-mainframe

跨会话使用相同的用户 ID 可以保持其已连接账户的状态。

调用工具

# 格式:pdauth call <app>.<工具名> [键=值 ...]

# 简单参数
pdauth call slack.send_message channel=general text="你好"

# 使用 JSON 参数处理复杂数据
pdauth call notion.create_page --args '{"title": "我的页面", "content": "..."}'

# 获取 JSON 格式输出以便解析
pdauth call spotify.get_my_playlists --json

检查状态

# 查看用户已连接的应用
pdauth status --user pedro

# 查看所有用户
pdauth status --all

# 获取 JSON 格式输出用于脚本处理
pdauth status --user pedro --json

热门应用

浏览所有应用:https://mcp.pipedream.com

应用 标识符 示例工具
Slack slack send_message, list_channels
Spotify spotify get_my_playlists, add_to_playlist
Notion notion create_page, query_database
Google Sheets google_sheets get_values, update_values
Gmail gmail send_email, list_messages
GitHub github create_issue, list_repos
Linear linear create_issue, list_issues
Airtable airtable list_records, create_record

错误处理

  • "App not connected"(应用未连接) → 使用 pdauth connect 生成链接并请求用户授权。
  • "Tool not found"(工具未找到) → 使用 pdauth tools <app> 列出可用工具。
  • "Invalid credentials"(凭据无效) → 运行 pdauth config 设置 Pipedream 凭据。

使用技巧

  1. 先检查状态:在尝试调用工具前,先检查连接状态。
  2. 使用一致的用户 ID:确保跨会话使用相同的用户 ID,以保持连接持久性。
  3. JSON 输出:使用 --json 参数获取结果,便于程序化解析。
  4. 链接有效期:OAuth 链接在 4 小时后过期,需要时请生成新的链接。

示例工作流

用户:"将 'Bohemian Rhapsody' 添加到我的 Spotify 播放列表"

代理:
1. pdauth status --user telegram:5439689035 --json
   → Spotify 未连接

2. pdauth connect spotify --user telegram:5439689035
   → 获取 OAuth 授权链接

3. 发送给用户:"我需要 Spotify 访问权限。请点击此处授权:<链接>"

4. 用户完成授权

5. pdauth status --user telegram:5439689035
   → Spotify ✓ 已连接

6. pdauth call spotify.search_tracks query="Bohemian Rhapsody" --json
   → 获取曲目 ID

7. pdauth call spotify.add_to_playlist playlist_id=... track_id=...
   → 完成!

8. 回复:"已将 Bohemian Rhapsody 添加到您的播放列表!🎵"
3 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor