pdauth — Dynamic OAuth for AI Agents
Use pdauth to give yourself (the agent) access to 2500+ APIs via OAuth. The flow:
- 1. Agent needs access to an app (Spotify, Slack, Notion, etc.)
- Generate an OAuth link with INLINECODE1
- Share link with user → they click and authorize
- Agent can now call tools via INLINECODE2
Quick Reference
CODEBLOCK0
The OAuth Flow (How to Request Access)
When you need access to an app the user hasn't authorized:
CODEBLOCK1
User ID Strategy
Use a consistent identifier per user:
- - Telegram: INLINECODE3
- Email: INLINECODE4
- Custom: INLINECODE5
The same user ID across sessions maintains their connected accounts.
Calling Tools
CODEBLOCK2
Checking Status
CODEBLOCK3
Popular Apps
Browse all at https://mcp.pipedream.com
| App | Slug | Example Tools |
|---|
| Slack | INLINECODE6 | sendmessage, listchannels |
| Spotify |
spotify | get
myplaylists, add
toplaylist |
| Notion |
notion | create
page, querydatabase |
| Google Sheets |
google_sheets | get
values, updatevalues |
| Gmail |
gmail | send
email, listmessages |
| GitHub |
github | create
issue, listrepos |
| Linear |
linear | create
issue, listissues |
| Airtable |
airtable | list
records, createrecord |
Error Handling
"App not connected" → Generate link with pdauth connect and ask user to authorize
"Tool not found" → List available tools with INLINECODE15
"Invalid credentials" → Run pdauth config to set up Pipedream credentials
Tips
- 1. Always check status first before attempting tool calls
- Use consistent user IDs so connections persist across sessions
- JSON output (
--json) is best for parsing results programmatically - Link expiry — OAuth links expire after 4 hours, generate fresh ones as needed
Example Workflow
CODEBLOCK4
pdauth — AI代理的动态OAuth
使用pdauth让您(代理)通过OAuth访问2500+个API。流程如下:
- 1. 代理需要访问某个应用(Spotify、Slack、Notion等)
- 使用pdauth connect <应用>生成OAuth链接
- 将链接分享给用户 → 用户点击并授权
- 代理现在可以通过pdauth call <应用.工具>调用工具
快速参考
bash
配置(一次性设置)
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
myplaylists --user 用户ID
pdauth call slack.send_message channel=general text=Hello!
OAuth流程(如何请求访问权限)
当您需要访问用户尚未授权的应用时:
- 1. 运行:pdauth connect <应用> --user <用户ID>
- 从输出中获取OAuth链接
- 将链接发送给用户:要执行此操作,我需要访问<应用>。点击此处授权:<链接>
- 用户点击,通过Pipedream授权
- 确认:pdauth status --user <用户ID>
- 现在您可以调用工具了!
用户ID策略
为每个用户使用一致的标识符:
- - Telegram:telegram:5439689035
- 邮箱:pedro@example.com
- 自定义:pedro-mainframe
跨会话使用相同的用户ID可以保持其已连接的账户。
调用工具
bash
格式:pdauth call <应用>.<工具名称> [键=值 ...]
简单参数
pdauth call slack.send_message channel=general text=Hello
复杂数据的JSON参数
pdauth call notion.create_page --args {title: 我的页面, content: ...}
获取JSON输出以便解析
pdauth call spotify.get
myplaylists --json
检查状态
bash
查看用户已连接的内容
pdauth status --user pedro
查看所有用户
pdauth status --all
用于脚本的JSON格式
pdauth status --user pedro --json
热门应用
浏览全部应用请访问 https://mcp.pipedream.com
| 应用 | 标识符 | 示例工具 |
|---|
| Slack | slack | sendmessage, listchannels |
| Spotify |
spotify | get
myplaylists, add
toplaylist |
| Notion | notion | create
page, querydatabase |
| Google Sheets | google
sheets | getvalues, update_values |
| Gmail | gmail | send
email, listmessages |
| GitHub | github | create
issue, listrepos |
| Linear | linear | create
issue, listissues |
| Airtable | airtable | list
records, createrecord |
错误处理
应用未连接 → 使用pdauth connect生成链接,让用户授权
未找到工具 → 使用pdauth tools <应用>列出可用工具
凭据无效 → 运行pdauth config设置Pipedream凭据
提示
- 1. 在尝试调用工具前始终先检查状态
- 使用一致的用户ID以便连接跨会话持久保存
- JSON输出(--json)最适合以编程方式解析结果
- 链接过期 — 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.addtoplaylist playlistid=... trackid=...
→ 完成!
- 8. 回复:已将Bohemian Rhapsody添加到您的播放列表!🎵