[v12] Problems in using Dropbox backup

Dear All,Until Version11.1.35 i could easily use Dropbox by creating the access token in the Dropbox setting.Since dropbox customization is gone from the Dropbox settings,it has been a nightmare getting backup from latest versions.I have read almost all information about Dropbox in the forum and i have not been able to see any valid solutions.
Dear friends kindly give a pointer to how to use dropbox to take back.
This is the error message i have whenever i click ALLOW DROPBOX ACCESS:
“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:
Invalid redirect_uri. When response_type=code, only localhost URIs can start with “http://”; all others must start with “https://”.”

Basically the token field was disabled and the ability to customise the doctype and re-enable the field has been disabled as well. Without the token, you cannot authenticate your dropbox access and use for backup. I raised an issue about it some time ago here:

and got no response.

Any clue will be appreciated @wale, @nabinhait, @tundebabzy, @johnskywalker

Hi @Fred1

Following the steps here:

https://erpnext.com/docs/user/manual/en/erpnext_integration/dropbox-backup

At what step exactly do you encounter the issue? I don’t immediately see anything about an access token

Kind regards,

The issue is simple really. the Dropbox Access Token field has been hidden in the Dropbox Settings Doctype and permission to customize the Dropbox Settings Doctype to unhide the field is now disabled by default as of v11.1.4 (i think). In order to customize the Doctype and unhide the field, you need to enable developer mode in site_config.json.

Previously it wasn’t necessary to enable developer mode to be able to successfully setup dropbox backup as the Doctype was easily customizable by default if the field is hidden. This suggests that as part of securing core Doctypes as of late v11 and now v12, the default permissions is now set to tougher restrictions for Dropbox Settings Doctype.

This should not be the case as setting up Dropbox backup is supposed to be a standard backup option for noobs and first timers who are setting up ERPNext for the first time.

@wale I think @flexy2ky has explained it all.
But the challenge is that going to developer mode to change a core document,will it not cause problem at update as i have learned in the form.
One then wonder at why our amiable team decided to remove the possibility to customize dropbox without turning on developer mode.

I also received the error after clicking enable. On inspecting the URL I noticed that the “s” was missing in the callback:

https://www.dropbox.com/oauth2/authorize?client_id=clientid&redirect_uri=http%3A%2F%2Fexample.com%2Fapi%2Fmethod%2Ffrappe.integrations.doctype.dropbox_settings.dropbox_settings.dropbox_auth_finish&state=state&response_type=code

Adding the s and hitting enter got me the Dropbox auth screen:

https://www.dropbox.com/oauth2/authorize?client_id=clientid&redirect_uri=https%3A%2F%2Fexample.com%2Fapi%2Fmethod%2Ffrappe.integrations.doctype.dropbox_settings.dropbox_settings.dropbox_auth_finish&state=state&response_type=code

Same issue and solution for authorizing Google Drive.

ERPNext: v12.2.2 (version-12)

Frappe Framework: v12.0.20 (version-12)

ERPNext: v12.5.2 (version-12)
Frappe Framework: v12.3.0 (version-12)

Where to make that change? Not sure if same issue

Getting server error after clicking allow access and after clicking on
https://www.dropbox.com/oauth2/authorize screen and clicking Allow get SERVER ERROR last call is requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.dropboxapi.com/oauth2/token

The change I made to the url was in the redirect_uri key by adding an “s” to “http” so it read “https” for my domain.

I guess not same issue as redirect URI in drop box is already https://example.com/api/method/frappe.integrations.doctype.dropbox_settings.dropbox_settings.dropbox_auth_finish

If I change to what you indicate above get. Invalid redirect_uri:

Error is on erpnext page so will have to dive into oauth stuff for erpnext

Hi @tonto, did you ever figure out the problem? I’m getting the same error (“400 Client Error” after clicking the allow button on Dropbox). Thanks in advance.

@Ryan_Bohm I had given up, but happened to try again about 3 weeks ago and worked. I still had the change in the redirect_uri_key. I was on latest ERPnext version for that time.

Good luck

@tonto Thanks. But you don’t know what changed that caused it to finally work?

Anyone else have any luck getting Dropbox backups to work with the current V12 version? I’m really struggling with this and hope someone can try to set it up with the latest code and see if it’s a bug or something on my end. Thanks in advance.

Thinking back only additional step was I recopied from dropbox app page to ERPnext form the app access key and app secret key. For whatever its worth did it in Chrome and I had to allow a ton of cookies and scripts for dropbox my plug-ins block by default.

hello @Ryan_Bohm did you solve your problem ?

@kkulloters Unfortunately, no. I’m just having to manually copy backups and get a daily email that backups failed:

Oops, your automated backup to Dropbox failed.

Error message: No Access Token exists! Please generate the access token for Dropbox. Traceback (most recent call last): File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 56, in take_backup_to_dropbox if did_not_upload: raise Exception Exception

I have no idea what to try next. It seems this is broken but I haven’t had anyone else recently tell me they tried it and it worked/didn’t work. Would love to know if I’m the only one (something wrong on my end) or if others trying to get this working get the same results.

have you created your access token in your dropbox ? and copy it in your config ?
so your config may look like this

@kkulloters First off, thanks for responding. Sorry for my slow response.

I previously tried copying this in and it didn’t work (it actually seemed to break something - can’t remember exactly what happened). I’ll try it again though and report what happens.

But I am a bit confused - I didn’t have to copy anything into the config file on the installation I have that is working? (I have two installations of ERPNext for different businesses - one that has Dropbox working and the other that I’m trying to get working).

BTW, I did try ensuring that the information was included in the site_config.json file, but still no-go. I can’t get the Dropbox backup to work which is really frustrating. I’d just like someone to set up a new installation and verify that they can get it working (and tell how) with the latest code. Maybe there aren’t that many people using this feature and something has been broken in the code. As I’ve said previously. I have another installation that was previously set up several versions ago (V11 if I remember correctly) and is working fine. But any new ERPNext installation I try to set up (for a different company) won’t work.

FYI, I got it working. I posted how in this thread: After migration: Dropbox Encryption key is invalid - #20 by daleksec