Application Register

To use Dropbox API an application needs creating at

Create a new application, select either Dropbox API or Dropbox Business API Next select the type of access needed either the app folder (useful for isolating to a single folder), or full Dropbox. Next copy and paste the APP Key and App Secret into your .env file:


Now enter your desired redirect URL. This is the URL your application will use to connect to Dropbox API.

A common URL is


Via Composer

composer require dcblogdev/laravel-dropbox


You can publish the config file with:

php artisan vendor:publish --provider="Dcblogdev\Dropbox\DropboxServiceProvider" --tag="config"

When published, the config/dropbox.php config file contains, make sure to publish this file and change the scopes to match the scopes of your Dropbox app, inside Dropbox app console.


return [

    * set the client id
    'clientId' => env('DROPBOX_CLIENT_ID'),

    * set the client secret
    'clientSecret' => env('DROPBOX_SECRET_ID'),

    * Set the url to trigger the oauth process this url should call return Dropbox::connect();
    'redirectUri' => env('DROPBOX_OAUTH_URL'),

    * Set the url to redirecto once authenticated;
    'landingUri' => env('DROPBOX_LANDING_URL', '/'),

     * Set access token, when set will bypass the oauth2 process
    'accessToken' => env('DROPBOX_ACCESS_TOKEN', ''),

     * Set access type, options are offline and online
     * Offline - will return a short-lived access_token and a long-lived refresh_token that can be used to request a new short-lived access token as long as a user's approval remains valid.
     * Online - will return a short-lived access_token
    'accessType' => env('DROPBOX_ACCESS_TYPE', 'offline'),

    set the scopes to be used
    'scopes' => ' files.metadata.write files.content.write',


You can publish the migration with:

php artisan vendor:publish --provider="Dcblogdev\Dropbox\DropboxServiceProvider" --tag="migrations"

After the migration has been published you can create the tokens tables by running the migration:

php artisan migrate

.ENV Configuration

Ensure you've set the following in your .env file:


Bypass Oauth2 You can bypass the oauth2 process by generating an access token in your dropbox app and entering it on the .env file:


Help support the blog so that I can continue creating new content!

Fathom Analytics $10 discount on your first invoice using this link

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2006 - 2023 DC Blog. All code MIT license. All rights reserved.