Dropbox access error

Hi!
I’m trying to setup dropbox backups and i’m getting the follow error:

ERPNext: v8.2.3 (master)
Frappe Framework: v8.2.4 (master)

Traceback (most recent call last):
  File "/home/erp/erpnext/apps/frappe/frappe/app.py", line 61, in application
    response = frappe.api.handle()
  File "/home/erp/erpnext/apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "/home/erp/erpnext/apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/erp/erpnext/apps/frappe/frappe/handler.py", line 52, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/erp/erpnext/apps/frappe/frappe/__init__.py", line 914, in call
    return fn(*args, **newargs)
  File "/home/erp/erpnext/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py", line 254, in dropbox_auth_finish
    token = dropbox_oauth_flow.finish({'state': callback.state, 'code': callback.code})
  File "/home/erp/erpnext/env/local/lib/python2.7/site-packages/dropbox/oauth.py", line 426, in finish
    no_redirect_result = self._finish(code, self.redirect_uri)
  File "/home/erp/erpnext/env/local/lib/python2.7/site-packages/dropbox/oauth.py", line 120, in _finish
    resp.raise_for_status()
  File "/home/erp/erpnext/env/local/lib/python2.7/site-packages/requests/models.py", line 928, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 400 Client Error: Bad Request for url: https://www.dropbox.com/oauth2/token

We are also getting this error on latest version.

Error (400)
It seems the app you were using submitted a bad request. If you would like to report this error to the app’s developer, include the information below.

More details for developers

Invalid redirect_uri. When response_type=code, only localhost URIs can start with “http://”; all others must start with “https://”.

@kolate, were you able to fix this?
I am also facing the same issue.

Below are the steps I have done so far;

  1. Created Dropbox app as shown below

  2. edited /home/frappe/frappe-bench/sites/sitename/site_config.jason
    from
    {
    “db_name”: “XXXXXXXXXX”,
    “db_password”: “XXXXXXXXXX”,
    “encryption_key”: “XXXXXXXXXXXXXXXXXXXXXXXX”,
    “limits”: {
    “space_usage”: {
    “backup_size”: 21.0,
    “database_size”: 49.48,
    “files_size”: 242.0,
    “total”: 312.48
    }
    }
    }

to
{
“db_name”: “XXXXXXXXXX”,
“db_password”: “XXXXXXXXXX”,
“dropbox_access_key”: “ACCESSKEY”,
“dropbox_secret_key”: “SECRECTKEY”,
“encryption_key”: “XXXXXXXXXXXXXXXXXXXXXXXX”,
“limits”: {
“space_usage”: {
“backup_size”: 21.0,
“database_size”: 49.48,
“files_size”: 242.0,
“total”: 312.48
}
}
}

  1. bench restart

  2. Under Integrations->Backup Settings->Dropbox Settings, changed the settings as below

  3. Click on the Allo Dropbox Access

  4. New windows popup with the below error

I am not able to find the issue here. Could any one give a hand…thanks!

can you set redirect url.

Also redirect url is wrong in current frappe version.
You need to change redirect url and add ssl.

Dropbox have updates their API’s. Now with new API you have to specify redirect Uri in your app.

Also http is only valid if redirect URL is localhost, for all other domains you need https.

1 Like

Thanks Kolkate, Saurabh

How could I add SSL for my erpNext site? I am having a self hosted server.

@fasilkaks you can take ssl from lets encrypt.

https://github.com/frappe/erpnext/wiki/Setting-up-TLS-SSL-certificates-Let’s-Encrypt-for-ERPNext-sites

@kolkate

installed SSL following Setting up TLS SSL certificates Let's Encrypt for ERPNext sites · frappe/erpnext Wiki · GitHub

The installation was successful. Does this mean that my site now will work with https:// ?

If yes, I am missing something as I can’t get my site with https:// and is still working fine with http://

@fasilkaks
I have found one hack to this issue.

In dropbox setting you can directly acc dropbox access token, let me know when you online tomorrow.
At that case no need to do ssl certificate.

Please check this url to setup dropbox Setup dropbox backup [User Manual]