Generating credentials for Dropbox authentication
StandardDropboxCredentialService requires "App Key", "App Secret", "Access Token" and "Refresh Token".
This document describes how to generate these credentials using an existing Dropbox account.
Generate App Key and App Secret
- Login with your Dropbox account.
- If you already have an app created, go to Dropbox Developers page,
click on "App Console" button and select your app. On the app's info page you will find the "App key" and "App secret".
(See also Dropbox Getting Started, App Console tab, "Navigating the App Console" chapter)
- If you don't have any apps, go to Dropbox Developers page and
click on "Create app" button. (See also Dropbox Getting Started, App Console tab,
"Creating a Dropbox app" chapter.)
- On the next page select "Scoped access" and "Full Dropbox" as access type.
- Provide a name for your app.
- On the app's info page you will find the "App key" and "App secret".
Dropbox Getting Started, App Console tab, "Navigating the App Console" chapter.)
Set required permissions for your app
The "files.content.read" permission has to be enabled for the application to be able to read the files in Dropbox. Click on "App Console" button and select your app.
Go to "Permissions" tab and enable the "files.content.read" permission.
Click "Submit" button.
NOTE: In case you already have an Access Token and Refresh Token, those tokens have to be regenerated after the permission change.
See "Generate Access Token and Refresh Token" chapter about token generation.
You can set permissions in Dropbox Developers page.
Generate Access Token and Refresh Token
"Access Code Generated
Enter this code into your_app_name to finish the process
Execute the following command from terminal to fetch the access and refresh tokens.
Make sure you execute the curl command right after the access code generation, since the code expires very quickly.
In case the curl command returns "invalid grant" error, please generate a new access code (see previous step)
curl https://api.dropbox.com/oauth2/token -d code=your_generated_access_code -d grant_type=authorization_code -u your_app_key:your_app_secret
The curl command results a json file which contains the "access_token" and "refresh_token":
"scope": "files.content.read files.metadata.read",