dsimonson

Dropbox Integration: Success! at least in part...

Discussion created by dsimonson on May 25, 2018
Latest reply on Jun 8, 2018 by dsimonson

Ok, I figured out how to use a web viewer in my solution to take the user to Dropbox to allow them to authorize my Dropbox "app" so they can save files to it.

 

All I needed to do was create a web viewer on the layout and, in the Web Address, put the following:

 

https://www.dropbox.com/oauth2/authorize?client_id=<my_dropbox_app_key>&response_type=code

 

The variable <my_dropbox_app_key> is obtained from the App Console page for my Dropbox App.  Note that it does not have quotes around it! 

 

When the user goes to the layout, the web viewer fires up and they are taken to the Dropbox website to sign in (unless they are already signed in).  Once they sign in, they are taken this page, giving them the opportunity to authorize my app (note: I have two Dropbox accounts, most users would only see one):

 

 

When they click/tap the button, because I did not include the redirect_uri parameter in my GET url, instead of passing back the authorization token in the response, it takes the user to this page (still within the web viewer)

 

The reason I did not include the redirect_uri parameter is because I don't know what would happen.  What URL should I use? I have to put it into the "Redirect URIs" field on my Dropbox App page, but I don't understand what URI to use.  The example has this:

 

https://www.example.com/mycallback?code=<authorization code>&state=<CSRF token>

 

I'm going to ignore the "state" variable, but boy do I need that <authorization code>!  My goal is to put it into a field somewhere in the user preferences, and use it in my script that uploads my pdfs to the Apps/OSAEMRtest/ folder on the user's Dropbox account.

 

So - any ideas on what to put in my redirect_uri?  Obviously I would like something returned to my webviewer that I can then parse to get the response code instead of having to have the user copy and paste it in to a field, but I'm stuck here. 

Outcomes