cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

Got a token, but still no go on uploading

dsimonson
Explorer | Level 4

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!

1 Reply 1

Re: Got a token, but still no go on uploading

Dropboxer
Dropboxer

Regarding the issue with not being able to log in, it's likely because the webviewer you're using is not officially supported by the Dropbox web site. You should use the system browser, instead of a web view, per the documentation.

 

The 401 issue is because you're attempting to use an "authorization code" as your "access token". The two are actually different; you need to perform one more step to exchange the authorization code for an actual access token. You can find more information on this in the Dropbox OAuth guide and documentation. This old blog post may also be helpful. (It was written for API v1 a.k.a. the Core API, which is now retired, but the OAuth 2 part still works the same.)

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?