| <!DOCTYPE html> |
| <html lang="en" xmlns="http://www.w3.org/1999/html"> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| http://www.apache.org/licenses/LICENSE-2.0 |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <head> |
| <meta charset="utf-8"/> |
| <title>StandardDropboxCredentialService</title> |
| <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/> |
| </head> |
| <body> |
| |
| <h1>Generating credentials for Dropbox authentication</h1> |
| |
| <p> |
| StandardDropboxCredentialService requires "App Key", "App Secret", "Access Token" and "Refresh Token". <br><br> |
| This document describes how to generate these credentials using an existing Dropbox account. |
| </p> |
| |
| <h3>Generate App Key and App Secret</h3> |
| |
| <p> |
| <ul> |
| <li> Login with your Dropbox account.</li> |
| <li>If you already have an app created, go to <a href="https://www.dropbox.com/developers">Dropbox Developers</a> 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".<br> |
| (See also <a href="https://www.dropbox.com/developers/reference/getting-started"> Dropbox Getting Started</a>, App Console tab, "Navigating the App Console" chapter)</li> |
| |
| <li> If you don't have any apps, go to <a href="https://www.dropbox.com/developers">Dropbox Developers</a> page and |
| click on "Create app" button. (See also <a href="https://www.dropbox.com/developers/reference/getting-started"> Dropbox Getting Started</a>, App Console tab, |
| "Creating a Dropbox app" chapter.) |
| <ul> |
| <li> On the next page select "Scoped access" and "Full Dropbox" as access type.</li> |
| <li> Provide a name for your app.</li> |
| <li>On the app's info page you will find the "App key" and "App secret". |
| (See also <a href="https://www.dropbox.com/developers/reference/getting-started"> |
| Dropbox Getting Started</a>, App Console tab, "Navigating the App Console" chapter.) |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </p> |
| |
| <h3>Set required permissions for your app</h3> |
| <p>The "files.content.read" permission has to be enabled for the application to be able to read the files in Dropbox.<br><br> |
| You can set permissions in <a href="https://www.dropbox.com/developers">Dropbox Developers</a> page. |
| <li> Click on "App Console" button and select your app.</li> |
| <li> Go to "Permissions" tab and enable the "files.content.read" permission.</li> |
| <li> Click "Submit" button.</li> |
| <li> 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.</li> |
| </p> |
| |
| <h3>Generate Access Token and Refresh Token</h3> |
| <p> |
| <ul> |
| <li>Go to the following web page: |
| |
| <pre>https://www.dropbox.com/oauth2/authorize?token_access_type=offline&response_type=code&client_id=<i>your_app_key</i></pre></li> |
| |
| <li>Click "Next" and click on "Allow" button on the next page.</li> |
| <li>An access code will be generated for you, it will be displayed on the next page:</li> |
| <pre> |
| "Access Code Generated |
| Enter this code into your_app_name to finish the process |
| <i>your_generated_access_code</i>" |
| </pre> |
| <li>Execute the following command from terminal to fetch the access and refresh tokens. <br><br> |
| Make sure you execute the curl command right after the access code generation, since the code expires very quickly.<br> |
| In case the curl command returns "invalid grant" error, please generate a new access code (see previous step)<br> |
| |
| <pre>curl https://api.dropbox.com/oauth2/token -d code=<i>your_generated_access_code</i> -d grant_type=authorization_code -u <i>your_app_key</i>:<i>your_app_secret</i></pre> |
| <br><br> |
| </li> |
| <li>The curl command results a json file which contains the "access_token" and "refresh_token":</li> |
| <code> |
| <pre> |
| { |
| "access_token": "sl.xxxxxxxxxxx" |
| "expires_in": 14400, |
| "refresh_token": "xxxxxx", |
| "scope": "files.content.read files.metadata.read", |
| "uid": "xxxxxx", |
| "account_id": "dbid:xxxx" |
| } |
| </pre> |
| </code> |
| </ul> |
| </p> |
| |
| |
| </body> |
| </html> |