PHP: Dropbox API OAuth Setup

May 30, 2022

Dropbox is a file hosting service where you can upload your files for several purposes such as storage, sharing, and backup.

Dropbox has an API that you can use to automate these processes.

On this and the subsequent posts we will be showing how to integrate the API into a website using PHP.

The first requirement for the integration with the API is to create an App in the Dropbox Developer Portal.

Sign in into your Dropbox account and go to the Console App page:

On the Console App page, click on the "Create app" button.

My Apps page in Dropbox

On the new app page enter the following information:

  1. Choose an API
    The only option is "Scoped access New"
  2. Choose the type of access you need.
    On this item we selected the "App folder" option. This will create a new folder where the app will be storing files.
    This option also prevents the app to access another folders.
  3. Name your app.
    Enter any name you want for your app.

Then, read the Dropbox API Terms and Conditions, and confirm that you agree with them by checking the box.

Click the "Create app" button.

Create new App in Dropbox

Then, you will be redirected to the Settings page.

On this page you will find the App key and the App secret (click on the "Show" link) and take note of them.
You will use both to authorize and access the Dropbox API.

App Settings page

Then, click on the Permission tab to select the specific permissions for Files and Folders.

On this page we have checked the following options:

  • files.metadata.write
  • files.content.write

App Permissions page

After that click on the "Submit" button to save the new Permissions.

Permissions Saved

On the next post we will create the php script files needed to implement the OAuth Setup process.