After migration: Dropbox Encryption key is invalid

https://erpnext.org/docs/user/manual/en/setting-up/integrations/dropbox-backup

Seems you need to recheck:
Step 4: Insert your custom domain Redirect URI

There is a problem visible in the error message in the URI.
“http://None/api/method/dropbox_erpnext_broker.**www.**setup_dropbox.get_authotize_url?”

That encryption key error occurs after you do a restore of database to a new server.
If thats the case and you still have access to your previous server, go to that file site_config.json of your old server, you will see the encryption keys there. Copy them and paste them in the site_config.json of your new server

I did this step but yes I also noticed that. I dont know where the “none” is comming from. Everything is configured as it says in the manual

I can’t because I was on the hosted ERPNext

1 Like

Thats unfortunate. have you tried requesting your encryption keys from them?

I’ll try.
What I dont understand is that everything else work. If it really was a encryption key error, I wouldnt be able to add new user and do stuff like that…

1 Like

without the original encryption keys some functions might not work, backup being one of them.
what about email function, is it working? there isn’t really a list of what will work and what won’t. you just have to test the whole system see.

yes email work too. If I understand well, if it really was an encryption key problem, emails wouldnt work…

Hi @Samuel_Gervais

I think you need to check again OAuth 2 - Redirect URIs at dropbox and App key and App secret
And click again “Allow dropbox Access”

Make sure all are correct?

Selection_045

1 Like

Here’s another solution that works:

  1. Generate access token here:

  1. Run following in bench console:
doc = frappe.get_doc('Dropbox Settings', 'Dropbox Settings')
doc.dropbox_access_token = "[your generated token here]"
doc.save()
frappe.db.commit()
4 Likes

Thanks for your help.
Yes i’m sure the app access key is good and secret key too.
I did try to change the dropbox access token (this field is also accessible if you customize the doctype to unhide it).
Also tried with the bench console

The error I get after putting new access token is the same error: Encryption key is invalid, Please check site_config.json

I even created a new dropbox app and tried everything again and same error.

Hi

Try to input wrong app secret key => save=> allow Dropbox access => input correct app secret key => save => allow Dropbox access . My point want to update again app secret key again.

Thanks for your ideas. Still getting same error: Encryption key is invalid, Please check site_config.json

As a final resort, deleting Dropbox Settings and starting over should work.
(Yes, you can delete single DocTypes too.)

I have noticed that all issues crop up because the site name may have changed upon migration to another server. I guess the encryption key in site_config.json must be backed up too?

1 Like

Wow it worked! I deleted the dropbox settings (menu, delete. Then clean cache just in case) and enter settings again and it worked first time!

Regarding, the encryption key,yes I think it should be backup too.

2 Likes

This worked for me. Had to run these commands in the console as the “allow dropbox access” button gives error 400. Other posts have said to customize the dropbox settings form so you can enter an Access token generated from dropbox, but the menu–>customize button has been removed in newer versions of erpnext (leaving no way to enter the access token).

So from a command line, entering “bench console”, then the above solution solved my dropbox setup issues.

Thank you

Can anyone please try verify that they can get Dropbox working on a fresh install of ERPNext (i.e. latest version)? I really want it to work, and have tried everything I can think of and find on the forums. But I cannot get it to work! Thanks in advance.

Okay, so I got it working (finally!). I wanted to post here what I had to do. It was a combination of things learned from various forum posts - so thank you all.

Ultimately, it boiled down to an error in my generated access token. I didn’t copy and paste it due to the way I was using VirtualBox. In manually typing it, I thought an “I” (India) was a lower case “l” (“Lima”). Oops. So here’s the steps that it looks like were needed to make it work. I can’t say for sure that all of these were required as I didn’t try every combination. But the bench console step was the one that finally make it work, so I know that one is necessary.

  1. Fill out the information on the “Dropbox Settings” page in ERPNext. BTW, the “App access key” is called the “App key” on the Dropbox page (Login - Dropbox).
  2. Add the dropbox_access_key and dropbox_secret_key to the site_config.json file. Watch carefully that you have the quotation marks in the right place and commas. If not, you’ll get an “Internal Server Error” in ERPNext. Good example of how to do this in this forum post: [v12] Problems in using Dropbox backup - #16 by Ryan_Bohm
  3. Run the bench console as described in the post above in this thread. Make sure the generated access token is correct.

When I try to do the “Allow Dropbox Access” on the Dropbox Settings page, it gives me a 400 error. But this step is apparently not necessary when the above steps are performed.

Good resources or just posts about the same/similar issues:

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

2 Likes

Thank you… This solution worked well with me for Google drive where i was getting the same error of “Invalid encryption key”. I had to delete both google drive and google settings

I just had this problem again with email account after transfering to a new server. One thing that is weird is that you can’t delete a email account when this key is invalid and can’t add a new email account.

The solution is to manually go in the database (I’m using SQLWorkbench), go to tabEmailAccount and delete the user account manually.

Then you can go back in erpnext and add a new user account and it will work.