|
4 | 4 | <head> |
5 | 5 | <meta charset="utf-8"> |
6 | 6 | <meta name="viewport" content="width=device-width"> |
7 | | - <title>Dropbox Node SDK Index</title> |
| 7 | + <title>Dropbox JavaScript SDK Index</title> |
8 | 8 |
|
9 | 9 | <!--[if lt IE 9]> |
10 | 10 | <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |
|
20 | 20 | <div class="navbar navbar-default navbar-fixed-top "> |
21 | 21 | <div class="container"> |
22 | 22 | <div class="navbar-header"> |
23 | | - <a class="navbar-brand" href="index.html">Dropbox Node SDK</a> |
| 23 | + <a class="navbar-brand" href="index.html">Dropbox JavaScript SDK</a> |
24 | 24 | <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> |
25 | 25 | <span class="icon-bar"></span> |
26 | 26 | <span class="icon-bar"></span> |
|
93 | 93 |
|
94 | 94 |
|
95 | 95 | <section class="readme-section"> |
96 | | - <article><p><a href="https://github.com/dropbox/dropbox-sdk-js"><img src="https://cfl.dropboxstatic.com/static/images/sdk/javascript_banner.png" alt="Logo"></a></p> |
97 | | -<p><a href="https://www.npmjs.com/package/dropbox"><img src="https://img.shields.io/node/v/dropbox" alt="node-current"></a> |
98 | | -<a href="https://www.npmjs.com/package/dropbox"><img src="https://img.shields.io/npm/v/dropbox" alt="npm"></a> |
| 96 | + <article><h1>Dropbox JavaScript SDK</h1> |
| 97 | +<p><a href="https://github.com/dropbox/dropbox-sdk-js/actions/workflows/ci.yml"><img src="https://img.shields.io/badge/Node.js-22%20%7C%2024-339933?logo=nodedotjs&logoColor=white" alt="Node.js 22 and 24"></a> |
| 98 | +<a href="https://www.npmjs.com/package/dropbox"><img src="https://img.shields.io/npm/v/dropbox?logo=npm" alt="npm version"></a> |
99 | 99 | <a href="https://codecov.io/gh/dropbox/dropbox-sdk-js"><img src="https://codecov.io/gh/dropbox/dropbox-sdk-js/branch/main/graph/badge.svg" alt="codecov"></a></p> |
100 | | -<p>The offical Dropbox SDK for Javascript.</p> |
101 | | -<p>Documentation can be found on <a href="https://dropbox.github.io/dropbox-sdk-js/">GitHub Pages</a></p> |
| 100 | +<p>The official Dropbox API v2 SDK for JavaScript.</p> |
| 101 | +<h2>Runtime support</h2> |
| 102 | +<p>The SDK supports Node.js, modern web browsers, and Web Workers. Continuous |
| 103 | +integration currently tests Node.js 22 and 24. Browser and Worker environments |
| 104 | +must provide <code>Promise</code>, <code>fetch</code>, and <code>TextEncoder</code>; PKCE authentication also |
| 105 | +requires the Web Crypto API. Add polyfills when targeting older environments |
| 106 | +that do not provide the required APIs.</p> |
102 | 107 | <h2>Installation</h2> |
103 | | -<p>Create an app via the <a href="https://dropbox.com/developers/apps">Developer Console</a></p> |
104 | | -<p>Install via <a href="https://www.npmjs.com/">npm</a></p> |
105 | | -<pre class="prettyprint source"><code>$ npm install --save dropbox |
| 108 | +<p>Create an app in the <a href="https://dropbox.com/developers/apps">Developer Console</a>, then install the SDK from |
| 109 | +npm. Published npm packages already contain CommonJS, ES module, browser, and |
| 110 | +TypeScript builds; applications do not need to build the SDK from source. |
| 111 | +Published versions and release history are available on the |
| 112 | +<a href="https://www.npmjs.com/package/dropbox?activeTab=versions">npm versions page</a>.</p> |
| 113 | +<pre class="prettyprint source lang-sh"><code>npm install dropbox |
106 | 114 | </code></pre> |
107 | | -<p>Install from source:</p> |
108 | | -<pre class="prettyprint source"><code>$ git clone https://github.com/dropbox/dropbox-sdk-js.git |
109 | | -$ cd dropbox-sdk-js |
110 | | -$ npm install |
| 115 | +<h3>Node.js</h3> |
| 116 | +<pre class="prettyprint source lang-js"><code>const { Dropbox } = require('dropbox'); |
| 117 | + |
| 118 | +const dbx = new Dropbox({ |
| 119 | + accessToken: process.env.DROPBOX_ACCESS_TOKEN, |
| 120 | +}); |
| 121 | + |
| 122 | +dbx.filesListFolder({ path: '' }) |
| 123 | + .then(({ result }) => console.log(result.entries)) |
| 124 | + .catch(console.error); |
| 125 | +</code></pre> |
| 126 | +<h3>Browser application with a bundler</h3> |
| 127 | +<p>Webpack, Rollup, Vite, and similar tools can use the package's ES module build.</p> |
| 128 | +<pre class="prettyprint source lang-js"><code>import { Dropbox } from 'dropbox'; |
| 129 | + |
| 130 | +const dbx = new Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' }); |
| 131 | +</code></pre> |
| 132 | +<h3>Browser application from a CDN</h3> |
| 133 | +<p>The browser bundle exposes the SDK through the global <code>Dropbox</code> object. Pin an |
| 134 | +exact SDK version so a future breaking release cannot change your application |
| 135 | +unexpectedly.</p> |
| 136 | +<pre class="prettyprint source lang-html"><code><script src="https://cdn.jsdelivr.net/npm/dropbox@10.34.0/dist/Dropbox-sdk.min.js"></script> |
| 137 | +<script> |
| 138 | + const dbx = new Dropbox.Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' }); |
| 139 | +</script> |
111 | 140 | </code></pre> |
112 | | -<p>If you are using the repository from the browser, you can use any CDNs that hosts the Dropbox package by including a script tag with the link to the package. However, we highly recommend you do not directly import the latest version and instead choose a specific version. When we update and release a breaking change, this could break production code which we hope to avoid. Note, we follow <a href="https://semver.org/">semver</a> naming conventions which means that any major version update could contain a breaking change.</p> |
113 | | -<p>After installation, follow one of our <a href="https://github.com/dropbox/dropbox-sdk-js/tree/main/examples">Examples</a> or read the <a href="https://dropbox.github.io/dropbox-sdk-js/">Documentation</a>.</p> |
114 | | -<p>You can also view our <a href="https://www.dropbox.com/lp/developers/reference/oauth-guide">OAuth guide</a>.</p> |
| 141 | +<p>Do not hard-code production access tokens in public source code.</p> |
| 142 | +<h3>Web Worker</h3> |
| 143 | +<p>The same browser bundle can be loaded in a Worker:</p> |
| 144 | +<pre class="prettyprint source lang-js"><code>importScripts('https://cdn.jsdelivr.net/npm/dropbox@10.34.0/dist/Dropbox-sdk.min.js'); |
| 145 | + |
| 146 | +const dbx = new Dropbox.Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' }); |
| 147 | +</code></pre> |
| 148 | +<h3>Install from source</h3> |
| 149 | +<p>Building is required only when developing the SDK itself or running examples |
| 150 | +directly from this repository.</p> |
| 151 | +<pre class="prettyprint source lang-sh"><code>git clone https://github.com/dropbox/dropbox-sdk-js.git |
| 152 | +cd dropbox-sdk-js |
| 153 | +npm install |
| 154 | +npm run build |
| 155 | +</code></pre> |
| 156 | +<h2>Browser authentication and PKCE</h2> |
| 157 | +<p>Client-side applications cannot keep an app secret confidential. Never embed a |
| 158 | +Dropbox app secret in browser or Worker code. Use the OAuth authorization-code |
| 159 | +flow with PKCE and your app key instead. See the <a href="https://github.com/dropbox/dropbox-sdk-js/tree/main/examples/javascript/pkce-browser">browser PKCE example</a> |
| 160 | +and the <a href="https://www.dropbox.com/lp/developers/reference/oauth-guide">Dropbox OAuth guide</a>. PKCE requires a secure context and the |
| 161 | +Web Crypto API.</p> |
| 162 | +<p>Server applications can keep an app secret confidential and may use the regular |
| 163 | +authorization-code flow.</p> |
| 164 | +<h2>API reference</h2> |
| 165 | +<ul> |
| 166 | +<li><a href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html">Dropbox class</a> — Dropbox API routes for files, sharing, users, |
| 167 | +teams, and other namespaces.</li> |
| 168 | +<li><a href="https://dropbox.github.io/dropbox-sdk-js/DropboxAuth.html">DropboxAuth class</a> — OAuth URLs, PKCE, access tokens, and token |
| 169 | +refresh.</li> |
| 170 | +<li><a href="https://dropbox.github.io/dropbox-sdk-js/DropboxResponseError.html">DropboxResponseError class</a> — errors returned by API requests.</li> |
| 171 | +<li><a href="https://dropbox.github.io/dropbox-sdk-js/global.html">Global API</a> — generated methods and route type definitions.</li> |
| 172 | +</ul> |
| 173 | +<p>The complete generated <a href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html">API reference</a> is published on GitHub |
| 174 | +Pages.</p> |
115 | 175 | <h2>Examples</h2> |
116 | | -<p>We provide <a href="https://github.com/dropbox/dropbox-sdk-js/tree/main/examples">Examples</a> to help get you started with a lot of the basic functionality in the SDK. We provide most examples in both Javascript and Typescript with some having a Node equivalent.</p> |
| 176 | +<p>The <a href="https://github.com/dropbox/dropbox-sdk-js/tree/main/examples">examples</a> demonstrate common SDK operations. Most are available |
| 177 | +in both JavaScript and TypeScript, with additional Node.js OAuth examples.</p> |
117 | 178 | <ul> |
118 | 179 | <li> |
119 | 180 | <p><strong>OAuth</strong></p> |
@@ -185,7 +246,7 @@ <h4 class="modal-title">Search results</h4> |
185 | 246 | <span class="jsdoc-message"> |
186 | 247 | Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> |
187 | 248 |
|
188 | | - on 2026-07-16T05:59:45+00:00 |
| 249 | + on 2026-07-16T06:25:38+00:00 |
189 | 250 |
|
190 | 251 | using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. |
191 | 252 | </span> |
|
0 commit comments