I am using a webviewer (a control object on a FileMaker layout that acts like a browser) in my FileMaker solution to allow my users to interact with Dropbox and my app. I'm not sure if the problems I'm having are related to me being the app owner and then trying to act as another user, so I am describing everything here from what I encounter.
When I go to the FileMaker layout, the webviewer fires up using this url:
https://www.dropbox.com/oauth2/authorize?client_id=<myAppKey>&response_type=code&redirect_uri=https://www.osaemr.com
The user (me) is directed to a Dropbox login where I have the opportunity to login either with Google or with their email and password for Dropbox.
I have tried several time to login with my email address and password to Dropbox, but all I get is a spinner and nothing happens. So I log in with Google, and it works - but again, this might be where errors are occuring. If I go over to my Safari (MacOS) browser, I am able to log in to Dropbox with my email and password with no problems, but that doesnt' seem to help with my app in FileMaker.
Once logged in (via Google), I am taken to the App approval webpage, where I can approve my app (OSAEMR). Once I click on the button, I am taken to my redirect URI with the token appended to the URI.
I then parsed the token out of the URL and put it into the following cURL request to upload a file:
--header "Authorization: Bearer <myTokenIjustGotFromTheURL>"
--header "Dropbox-API-Arg: {\"autorename\":true,\"mode\":\"add\",\"mute\":false,\"path\":\"/OSAEMR/Testing/<myFileName>\"}"
--header "Content-Type: application/octet-stream"
--dump-header <myVariableForErrorResults>
--data-binary @<myFile>
And I get an error: "HTTP/1.1 100 Continue HTTP/1.1 401 invalid_access_token/. Server: nginx Date: Sat, 26 May 2018 15:49:38 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: keep-alive WWW-Authenticate: Bearer realm="Dropbox-API" Content-Security-Policy: sandbox allow-forms allow-scripts X-Dropbox-Request-Id: 47b29bec3e175321811caf44afda0d9b X-Robots-Tag: noindex, nofollow, noimageindex "
HOWEVER, if I substitute the token I generated for my app instead of the one provided by the redirect URL, it works fine. Frustrating! I hope you have enough info here to help me figure it out. Thanks!