2. Dropbox is a file hosting service operated by
Dropbox, Inc. , headquartered in San
Francisco, California. It offers cloud storage,
file synchronization, personal cloud, and
client software for Microsoft Windows, Mac
OS X, Linux, Android, iOS, BlackBerry OS,
Windows Phone and web browsers. In this
blog post, a step by step procedure of
connecting to Dropbox cloud using Mule ESB
Dropbox Cloud Connector is shown.
3. For this illustration, we are using
◦ Dropbox Cloud Connector 3.3.0
◦ Anypoint Studio
◦ Mule ESB Server 3.5.2
◦ Mule requester Module 1.2.0
To integrate Dropbox with Mule ESB, we will need a
Dropbox account
We need to create a new Dropbox app under
Dropbox developer apps in order to communicate
with the Dropbox account from Mule ESB
application
We will be using OAuth2 authentication to connect
to Dropbox using Mule ESB Dropbox Cloud
Connector
4. Go to https://www.dropbox.com/developers/apps
Click on Create app button
Click on Dropbox API app
Select “Files and datastores” radio button
Select “No – My app needs access to files already on
Dropbox” radio button
Select “All file types -My app needs access to a user’s full
Dropbox” radio button
Provide an app name and click on Create app button
Provide a redirect URI for OAuth2 and click on Add button
Make a note of the App key, App secret, Redirect URI as
these will be used in our Mule application to connect to
Dropbox cloud. A sample screen of a drop box app is
given below.
5.
6. Create a new Mule Application
Click on Global Elements tab in the main flow
Click on Create Button
Select Property Placeholder component
Provide the property file location and click on
OK. Our property file should have at least two
properties for app key and app secret which
will be used later in the Dropbox connector
configuration. A sample screen shot and XML
configuration is as follows:
8. Click on Global Elements tab in the main flow
Click on Create Button
Select Dropbox under Connector Configuration
group
Add the Dropbox App Key value to App Key text
box
Add the Dropbox Secret value to App Secret text
box
Click on Oauth tab and specify domain, local
port, remote port and path values. These values
should be same as provided in Redirect URI
during Dropbox app configuration. A sample
screen shot and XML configuration is as follows.
13. If the app authorizes in to the Dropbox app
successfully, the connector returns two flow
variables to Mule ESB flow which are
“_oauthVerifier” and “OAuthAccessTokenId”
Using Choice router, we can check if a flow
received is a valid “OAuthAccessTokenId” or
not and based on the response, we can
determine the success or failure of the
Dropbox authorization
14. Deploy the Mule application
Hit the following URL on the browser
◦ http://localhost:2222/dropboxcloudconnect
Dropbox will ask us to authorize your new
app to connect to Dropbox.
Click on Allow button and we should be
able to see a message printed on the
browser as “Authorization is successful”