Dropbox Lite:无缝云文件管理 - Openclaw Skills

作者:互联网

2026-04-17

AI快讯

什么是 Dropbox Lite?

Dropbox Lite 是一款专门设计的集成工具,旨在弥合 AI 智能体与云存储之间的差距。通过调用 Dropbox API,该技能允许用户直接在其自动化工作流中上传、下载和搜索文件。它是 Openclaw Skills 生态系统的重要组成部分,确保智能体在无需人工干预的情况下,能够持久且安全地访问数据存储。

该技能的突出特点是其自动 OAuth 令牌刷新机制。它通过使用长效刷新令牌获取新的访问令牌,智能地处理令牌过期问题,并即时更新本地配置。这使其成为开发人员构建需要可靠云文件访问的长期运行自主流程的必备工具。

下载入口:https://github.com/openclaw/skills/tree/main/skills/thekie/dropbox-lite

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install dropbox-lite

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 dropbox-lite。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Dropbox Lite 应用场景

  • 同步本地项目资产至云存储,供团队访问。
  • 自动获取文档或 PDF 数据集以供 AI 处理。
  • 为智能体生成的输出结果创建自动备份程序。
  • 搜索并列出远程目录内容,以映射项目结构。
  • 使用 Openclaw Skills 在分布式环境中管理共享资源。
Dropbox Lite 工作原理
  1. 智能体使用环境配置中存储的应用程序凭据和访问令牌进行身份验证。
  2. 当发布上传或下载等命令时,该技能会向 Dropbox API v2 发起请求。
  3. 如果当前访问令牌已过期(通常为 4 小时后),该技能会检测到 401 Unauthorized 错误。
  4. 该技能会自动使用存储的刷新令牌向 Dropbox 请求新的短效访问令牌。
  5. 新的访问令牌将写回配置文件,并无缝重试原始请求。

Dropbox Lite 配置指南

要将其与您的 Openclaw Skills 设置集成,请遵循以下步骤:

  1. 在 Dropbox 开发者门户创建一个分级访问(Scoped Access)应用。
  2. 启用权限:files.metadata.readfiles.metadata.writefiles.content.readfiles.content.writeaccount_info.read
  3. 生成带有 token_access_type=offline 的授权 URL 以获取刷新令牌。
  4. 使用 curl 将授权码交换为令牌。
  5. 将您的凭据保存在 ~/.config/atlas/dropbox.env 中:
DROPBOX_APP_KEY=your_app_key
DROPBOX_APP_SECRET=your_app_secret
DROPBOX_REFRESH_TOKEN=your_refresh_token

Dropbox Lite 数据架构与分类体系

该技能使用结构化的环境和路径系统来管理配置和文件交互:

组件 类型 描述
配置文件 .env 在 ~/.config/atlas/dropbox.env 中存储密钥和令牌
远程路径 字符串 以 / 开头的 Dropbox 路径(例如 /Backup/data.zip)
令牌类型 OAuth2 同时支持短效访问令牌和长效刷新令牌

所有路径均不区分大小写,并遵循标准的正斜杠约定,以确保在 Openclaw Skills 内的跨平台兼容性。

name: dropbox-lite
description: Upload, download, and manage files in Dropbox with automatic OAuth token refresh.
homepage: https://www.dropbox.com/developers

Dropbox

Upload, download, list, and search files in Dropbox. Supports automatic token refresh.

Required Credentials

Variable Required Description
DROPBOX_APP_KEY ? Yes Your Dropbox app key
DROPBOX_APP_SECRET ? Yes Your Dropbox app secret
DROPBOX_REFRESH_TOKEN ? Yes OAuth refresh token (long-lived)
DROPBOX_ACCESS_TOKEN Optional Short-lived access token (auto-refreshed)

Store in ~/.config/atlas/dropbox.env:

DROPBOX_APP_KEY=your_app_key
DROPBOX_APP_SECRET=your_app_secret
DROPBOX_REFRESH_TOKEN=xxx...
DROPBOX_ACCESS_TOKEN=sl.u.xxx...

Initial Setup (One-Time)

1. Create a Dropbox App

  1. Go to https://www.dropbox.com/developers/apps
  2. Click "Create app"
  3. Choose "Scoped access"
  4. Choose "Full Dropbox" (or "App folder" for limited access)
  5. Name your app
  6. Note the App key and App secret

2. Set Permissions

In the app settings under "Permissions", enable:

  • files.metadata.read
  • files.metadata.write
  • files.content.read
  • files.content.write
  • account_info.read

Click "Submit" to save.

3. Run OAuth Flow

Generate the authorization URL:

import urllib.parse

APP_KEY = "your_app_key"

params = {
    "client_id": APP_KEY,
    "response_type": "code",
    "token_access_type": "offline"  # This gets you a refresh token!
}

auth_url = "https://www.dropbox.com/oauth2/authorize?" + urllib.parse.urlencode(params)
print(auth_url)

Give the URL to the user. They will:

  1. Open it in a browser
  2. Authorize the app
  3. Receive an authorization code

4. Exchange Code for Tokens

curl -X POST "https://api.dropboxapi.com/oauth2/token" r
  -d "code=AUTHORIZATION_CODE" r
  -d "grant_type=authorization_code" r
  -d "client_id=APP_KEY" r
  -d "client_secret=APP_SECRET"

Response includes:

  • access_token — Short-lived (~4 hours)
  • refresh_token — Long-lived (never expires unless revoked)

Usage

# Account info
dropbox.py account

# List folder
dropbox.py ls "/path/to/folder"

# Search files
dropbox.py search "query"

# Download file
dropbox.py download "/path/to/file.pdf"

# Upload file
dropbox.py upload local_file.pdf "/Dropbox/path/remote_file.pdf"

Token Refresh

The script automatically handles token refresh:

  1. On 401 Unauthorized, it uses the refresh token to get a new access token
  2. Updates dropbox.env with the new access token
  3. Retries the original request

Token Lifecycle

Token Lifetime Storage
Access Token ~4 hours Updated automatically
Refresh Token Never expires* Keep secure, don't share

*Refresh tokens only expire if explicitly revoked or app access is removed.

Troubleshooting

401 Unauthorized on refresh:

  • App may have been disconnected — re-run OAuth flow from step 3

403 Forbidden:

  • Check app permissions in Dropbox console

Path errors:

  • Dropbox paths start with / and are case-insensitive
  • Use forward slashes even on Windows

API Reference

  • OAuth Guide: https://developers.dropbox.com/oauth-guide
  • API Explorer: https://dropbox.github.io/dropbox-api-v2-explorer/

相关推荐