Using Dropbox API is quite simple and easy. Procedure to get Access Token is also simple. However, each time I set up new application I have to go through the same procedure.
To help me out, I wrote very simple PHP script that simplifies process even more. It follows three stages of generating process in unified way, simplified to few click of mouse.
Stage1: Go to Dropbox site and create Dropbox Platform app (link is provided). You will get Access key and Access Secret. Copy that info to form and submit.
Stage2: open provided link to get Authorization Code. External page belongs to DropBox and basically just ask you to Allow usage of application. Click Allow and You will get Authorization Code.
Copy that code into provided edit box and submit again.
Stage3: Access Token will be generated for You. If error occurs just repeat Stage 2 to get another Authorization Code.
How to run DropBox Access Token Generator
DropBox Access Token Generator is not service, and I would not advise you to use any third party service as that would allow them to collect authentication data, which is something you would not like to happen.
DropBox Access Token Generator is actually very simple PHP script you can get from this page, save it as .PHP file and run on your own.
Pay attention that you have to install DropBox SDK by yourself and to set proper path to installed SDK.
Here is code download: get_access_key_token.php.txt (454 downloads)
How to use Access Token
That is very simple. Generator provided three information: Access Key, Access Secret and Access Token. That is all You need. Example how to use them to get DropBox account info follows:
<pre> <?php # Include the Dropbox SDK libraries require_once "dropbox/autoload.php"; use \Dropbox as dbx; $accessKey = 'htrcodosbx05sci'; $accessSecret = '8ghjszs28iecviu'; $accessToken = 'AC2MJwQhuh0AAAAAAAAdCd_b-BXHj76rfkQorxQnd5wngZqF7X3juX7awm_aY5TJ'; $appInfo = new dbx\AppInfo($accessKey, $accessSecret); $webAuth = new dbx\WebAuthNoRedirect($appInfo, "PHP-Example/1.0"); $dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0"); $accountInfo = $dbxClient->getAccountInfo(); echo "accountInfo:"; print_r($accountInfo); ?> </pre>
You can use this for any other DropBox API call.
Important note: Access Key, Access Secret and Access Token used in this article are invalid. You have to create your own.