Connecting to Dropbox from App Connect Enterprise as a Service
You can connect to Dropbox either from the App Connect Designer page (previously the Catalog page), or when you add an app to a flow.
- OAUTH 2.0 AUTH CODE
- BASIC OAUTH
For OAUTH 2.0 AUTH CODE, to connect App Connect to your Dropbox account, click Connect. App Connect connects to your Dropbox account automatically. You might be prompted to sign in if you are not already connected to Dropbox.
For BASIC OAUTH authorization method, enter the account information in the connection fields that are displayed (see the following table), and click Connect.
Field | Description |
---|---|
Access token | The long-lived or short-lived access token for your Dropbox application. Details about how to obtain this value are described below. |
Refresh token | The refresh token that is generated along with the short-lived access token. You can obtain the short-lived and refresh tokens pair by performing the Dropbox OAuth 2.0 authorization code flow steps as described in the following steps. A refresh token is generated to revalidate the expired short-lived access token. |
Client ID | The app key found in the settings page of your Dropbox application. This property is only required if you have provided the short-lived access token. |
Client secret | The app secret found in the settings page of your Dropbox application. This property is only required if you have provided the short-lived access token. |
- Sign up for a Dropbox developer account in the Drop box DBX platform.
- Click Create apps and complete the form to create an app. The Settings page of the app is displayed.
- In the OAuth 2 section, use the Access token expiration menu to select No expiration.
- Click Generate.
- The long-lived access token is displayed and ready for you to use to access your Dropbox account.
- Sign up for a Dropbox developer account in the Drop box DBX platform.
- Click Create apps and complete the form to create an app. The Settings page of the app is displayed.
- In the Status column of the Settings page, the App key
and App secret are displayed. The App key is the value that you need for the client ID and the App
secret is the value that you need for the client secret in App Connect.
- In the OAuth 2 section, add a redirect URI. For the
purposes of this example, we'll use
https://www.google.com/
. - Click Add.
- In the same section, use the Access token expiration menu to select Short-lived.
- To generate the access and refresh token pair, you need to generate an
authorization code. To do this, construct a Dropbox
authorization URL with your application’s client ID and redirect URI (if applicable) in the
following
format.
For example:https://www.dropbox.com/oauth2/authorize?client_id=MY_CLIENT_ID&redirect_uri=MY_REDIRECT_URI&response_type=code&token_access_type=offline
https://www.dropbox.com/oauth2/authorize?client_id=rt5alrhd93n7ga3&redirect_uri=https://www.google.com/&response_type=code&token_access_type=offline
Note: Ensure that the redirect URI matches the exact format that you specified in Step 4. For more information about the Dropbox authorization URL, see https://www.dropbox.com/lp/developers/reference/oauth-guide. - Paste the authentication URL into a browser window and click Enter to generate the authorization
code. The code is located in the query string, as displayed in the following image.
- Use an application such as IBM API Connect Test and Monitor or Postman to make a POST OAuth2
token call.
Update the parameters as specified in the following table:POST https://api.dropbox.com/1/oauth2/token
Table 2. Key Value grant_type authorization_code client_id The app key retrieved in Step 3 client_secret The app secret retrieved in Step 3 redirect_uri The redirect URI that you specified in Step 4 code The authorization code retrieved in Step 8 For example: - Click Send. The response is displayed with your access token and refresh token.Note: The refresh token does not expire unless you revoke the short-lived access token.
To connect App Connect to your Dropbox account, click Connect. App Connect connects to your Dropbox account automatically. You might be prompted to sign in if you are not already connected to Dropbox. This creates an account in App Connect. For more information, see Managing accounts.
Before you use the account that is created in App Connect in a flow, rename the account to something meaningful that helps you to identify it. To rename the account on the Applications and APIs page, select the account, open its options menu (⋮), then click Rename Account.