Dropbox OAuth

Professional Dropbox API integration with OAuth 2.0 and automatic token refresh

Overview

This node enables uploading files to Dropbox using the Dropbox API with OAuth 2.0 authentication. It supports uploading base64 encoded content or binary data to a specified path in the user's Dropbox storage. The node is useful for automating file uploads, such as saving generated reports, images, or backups directly into Dropbox folders.

Practical examples:

  • Uploading a dynamically generated PDF report to a specific Dropbox folder.
  • Saving user-uploaded images from a web form into Dropbox.
  • Automating backup of configuration files by uploading them to Dropbox daily.

Properties

Name Meaning
Upload Path The full path in Dropbox where the file will be uploaded (e.g., /folder/file.jpg).
File Content The file's content encoded in base64 or provided as binary data to upload.
Overwrite Whether to overwrite an existing file at the upload path (true to overwrite, false to add without overwriting).

Output

The output JSON contains details about the uploaded file under the uploaded_file field. This includes metadata returned by Dropbox such as file ID, name, path, and other attributes confirming the successful upload.

Example output structure:

{
  "resource": "file",
  "operation": "upload",
  "uploaded_file": {
    ".tag": "file",
    "name": "file.jpg",
    "path_lower": "/folder/file.jpg",
    "path_display": "/folder/file.jpg",
    "id": "id:abc123",
    "client_modified": "2024-06-01T12:00:00Z",
    "server_modified": "2024-06-01T12:00:01Z",
    "rev": "5c1a72",
    "size": 12345,
    "is_downloadable": true,
    "content_hash": "e3b0c44298fc1c149afbf4c8996fb924"
  }
}

If the file already exists and overwrite is set to false, Dropbox will rename the new file automatically.

Dependencies

  • Requires a valid OAuth 2.0 access token for Dropbox API authentication.
  • The node uses the Dropbox API endpoint https://content.dropboxapi.com/2/files/upload.
  • Requires n8n credentials configured with Dropbox OAuth 2.0 authentication.
  • Uses Axios HTTP client internally for API requests.

Troubleshooting

  • Invalid Access Token: If the OAuth token is expired or invalid, the node attempts to refresh it via a configured OAuth handler URL. Failure to refresh will cause an error. Ensure your OAuth credentials are correctly set up and the refresh token is valid.
  • File Path Errors: Providing an invalid or malformed upload path may result in API errors. Always specify the full path starting with /.
  • Overwrite Conflicts: If overwrite is false and a file with the same name exists, Dropbox renames the uploaded file. To avoid confusion, set overwrite to true if you want to replace files.
  • Base64 Encoding Issues: Ensure that the file content is properly base64 encoded or provided as binary data; otherwise, the upload may fail or produce corrupted files.

Links and References

Discussion