cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OAuth2 problems with Django and Django Db Backup

OAuth2 problems with Django and Django Db Backup

george-silva
New member | Level 2

Hello all!


I'm having a problem regarding the usage of the DropBox API.

 

I'm using dropbox to backup a few of my databases, which it worked perfectly.

 

I'm using Django, Django dbbackup and internally it uses the dropbox api. I've checked and we are using the latest versions of all libraries.

 

I have generated a proper Oauth2 key, using your UI to do so. I've configured it properly on my side, and tried to generate a backup. the backup get's generated but the upload to dropbox fails with an 413 error.

 

dropbox.rest.ErrorResponse: [413] Error parsing response body or headers: Body - '<!DOCTYPE html>\n<html>\n<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">\ Headers - HTTPHeaderDict({'Content-Length': '25546', 'X-Robots-Tag': 'noindex, nofollow, noimageindex', 'Server': 'nginx', 'Connection': 'close', 'ETag': '"58c83253-63ca"', 'X-Dropbox-Request-Id': '9aa2ced5c801b7f47ca37e7c5704d6bd', 'Date': 'Thu, 30 Mar 2017 15:06:45 GMT', 'Content-Type': 'text/html'})

 

 

Can you help me? 

 

Also another funny thing is that the generated key does not get persisted within my account. I ask to generate a new key, it does and it outputs it to me. I hit f5 to reload the page and it's gone, and I have the option to generate the key again.

 

Thoughts?

4 Replies 4

Greg-DB
Dropbox Staff

Regarding the 413 error, can you share the HTTP request being sent? (Just be sure to redact the access token.) A 413 error should indicate that the request payload was too large, so we should first determine what you're sending.

 

Also, when you refer to your OAuth 2 "key", do you mean your OAuth 2 access token? The access token itself doesn't expire, so the app should store and re-use it. Exactly how the app does that is up to the app though, and since "Django dbbackup" is made by a third party, we can't offer support for Django dbbackup itself.

george-silva
New member | Level 2

Hey Greg,

 

The error is not that the payload is too large. Here's the title:

Error parsing response body or header

Analyzing your code for your python dropbox implementation, this error occurs if there is no error message returned in the payload. It's the last case of a large if condition, here: https://github.com/dropbox/dropbox-sdk-python/blob/master/dropbox/rest.py#L406-L408

 

How can I generate a new key for an Dropbox App?

 

Well, I've created a new app.

 

There are a bunch of sections, such as:

 

* Status

* Development Users

* app folder name

* etc

* OAuth2

 

In that section, (oauth2), there are the following options:

 

* redirect urls

* allow implicit grant

* generate key

 

This application, particularly does not comunicate with a lot of users, just one, me. So I've generated the key and used to communicate between my Django application and Dropbox. Each time I click it, it generates a new key. If I hit f5, it will not show that key again. If I hit generate key again, it will give me another key.

 

Since this worked before, I know this problem is not located in django-dbbackup.

 

I must be doing something wrong, because this looks like a generic "cant connect error".

 

What is the correct way to generate a key, for **my user** to be used with oauth2?

 

 

Greg-DB
Dropbox Staff

Thanks for the additional information. Can you share the request itself though? That should help show what the issue is.

 

And yes, if you just need an access token for your own account on your own app, you can use that 'Generate' button to get one. The page will show it to you, and you should then copy it from the page, and then store and re-use it in your app. That page won't show it again if you refresh the page.

george-silva
New member | Level 2

Ok, regarding the token generation.

 

I'm already doing that.

 

The request itself is being made in two or three layers of opensource applications. I' ve searched these apps and there is no sign of registered bug in their side (it can be on their side, however).

 

I'll try to get the full request. I'll just edit my copy of dropbox lib and add a pdb there.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    george-silva New member | Level 2
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?