A node.js example of a Dropbox API app that requests a user to authorize access to the user's Dropbox.
This uses the OAuth 1.0 protocol as documented in the Dropbox API.
It also illustrates the use of MongoDB to persist the user's access token.
- Get a Dropbox API key.
- Set up and run a MongoDB instance.
- Edit environment variables as below.
npm install
to download dependencies (dbox, mongodb, express).node server.js
to launch the web app.- Browse to http://localhost:8888/
DROPBOX_APP_KEY =
DROPBOX_APP_SECRET =
MONGO_URI = mongodb://localhost:27017/test
CALLBACK_HOST = http://localhost:8888
- Visit http://localhost:8888/
- If cookied, displays a welcome message with your Dropbox username
- Otherwise, invokes the authorization flow:
- Obtain a temporary request token
- Direct the user to dropbox.com to authorize your app
- Acquire a permanent access token