Writing a file with the Dropbox JavaScript SDK
Steve Marx published a short "Hello World" walkthrough for writing a file to Dropbox from JavaScript. He points readers to the Getting Started guide bundled with dropbox.js as the most complete reference, and offers a minimal snippet for the basic task.
Running the snippet requires an app key from the App console, plus an OAuth redirect URI registered there that exactly matches the full URL where the app is running.
Marx notes the minimal version is not very realistic: it sends the user to authenticate with Dropbox the moment the page loads, and it performs no error handling. The authenticate call, in particular, can fail under ordinary conditions — for example, when a user chooses "Cancel" rather than "Allow" on the authorization page.
A revised, more complete version addresses both points: authentication happens only after the user clicks a button, and errors are handled. Marx uses the Datastore SDK in that example, noting that dropbox.js from GitHub works as an alternative and that the Datastore SDK carries the same file functionality.



