Dropbox API Introduction
Remarks[edit | edit source]
The Dropbox API allows developers to build Dropbox functionality directly into their apps.
The API allows access to features such as file uploading, downloading, sharing, searching, and restoration. The API can be used across platforms such as Windows, Mac, Linux, iOS, Android, or any other that can make HTTPS connections.
More information, including the full documentation for the Dropbox API, usage guidelines, and developer tools such as official SDKs can be found on the Dropbox API website.
The first step is to register an API app with Dropbox.
Versions[edit | edit source]
Getting an OAuth 2 access token for the Dropbox API via the code grant using curl[edit | edit source]
Step 1: Begin authorization
Send the user to this web page, with your values filled in:
https://www.dropbox.com/oauth2/authorize?client_id=<app key>&response_type=code&redirect_uri=<redirect URI>&state=<CSRF token>
The authorization code will be included as the
code parameter on the redirect URI.
Step 2: Obtain an access token
curl https://api.dropbox.com/oauth2/token -d code=<authorization code> -d grant_type=authorization_code -d redirect_uri=<redirect URI> -u <app key>:<app secret>
Step 3: Call the API
In your API call, set the header:
Authorization: Bearer <access token>
Check out the blog post for more details, including an important security note on using
state to protect against CSRF attacks.