-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DropBox tokens expire after 4 hours #362
Comments
thanks @YouveGotMeowxy :) To be honest, I'm not sure how fast I can fix this. I hope I can start looking into it maybe end of next week but I really can't make any promises :/ Plan so far:
|
@sebastianfeldmann ok, thank you for any work on it. :) I don't really know if this will help you out any, but I was just looking around about how to get a permanent token and came across this; maybe it might help ya out as well. https://www.codemzy.com/blog/dropbox-long-lived-access-refresh-token |
4 months since this issue; any forward-movement happening? :) |
I came across this post as I was having the same issue as I use Dropbox as well for my backups. I resolved it by getting the application access code as mentioned here: https://www.codemzy.com/blog/dropbox-long-lived-access-refresh-token. Using CURL, I retrieved the long lived refresh token using the application access code with a grant type of "authorization_code". I then created another CURL request to Dropbox asking for the short lived access token that I store in a MySQL database. To do that, you use the long lived refresh token from the first CURL request with the grant type of "refresh_token". An additional PHP script programmatically rebuilds the phpbu.xml file inserting the current refresh token into the line of The backup runs twice daily using multiple cron jobs. The first gets the updated short lived access token. The second updates the phpbu.xml script and the third runs the backup. Each cron job is separated by five minutes. This could be simplified to one cron job and script, but works fine as is and I have moved on to other projects. Anyway, thought this might be helpful as you navigate this issue. Overall, PHPBU is an excellent tool. Great job Sebastian! |
With version 6.0.26 the Dropbox integration was fixed. You need to create an App in your Dropbox AppConsole. <?xml version="1.0" encoding="UTF-8"?>
<sync type="dropbox">
<!-- mandatory -->
<option name="token" value="mycrazylongapitokenthatigotfromdropbox" />
<!-- mandatory -->
<option name="appKey" value="myAppKey" />
<!-- mandatory -->
<option name="appSecret" value="myAppSecret" />
<!-- mandatory -->
<option name="path" value="/some/dir" />
</sync> |
yaayy! thank you! I just tried to add those 2 new key:values and try with 6.0.26, and I get this error though?
The previous version 5.2.10 was working with the exception of the expiring token (IIRC) and the only things I've added now are the appkey and appsecret. It now looks like this:
My PHP versions is 7.4.33 Any idea? |
Yes, version 6 requires php 8 I think the dependencies are PHP 8 only but I can check and try to back port the feature to the 5.0 release version. |
ok! I was able to change to PHP 8.3 and got it to run. I'm getting a sync error now, but gonna look into it! |
My fault, I got it and it's working great! You just made my whole day, lol. thank you so much! <3 |
:( I guess I spoke too soon. It worked after I had generated the new superlongtoken, but then overnight when my cronjob ran the same command-line I woke up to the same error that token expired.
I don't know which specific info you may need from me to help out, just let me know. |
I think I have found a way with refresh tokens. |
In order to support short-lived tokens we have to provide a refresh token, which can be obtained from the Dropbox api. Fixes issue #362
It is finally fixed! The thing you have to be aware of is that you have to provide a You can use the dropbox-helper package I created to make the call and receive your refresh key. With that key, that you should never share with anybody, you can create short-lived api |
Thank you for keeping on top of this @sebastianfeldmann :) I'm probably being a doofus but when I run the new script, I just get this:
I don't get any return code to enter? I tried logging into both that particular app's settings page as well as the main account page, but see no "Refresh Token" or "Code" to enter into the new script? also, a couple other questions: once I do get my refresh token, do I just delete the original line (I'm using json btw):
and replace it with (in json version):
and from then on does that same refresh token always work, or do I need to repeat the helper script every so often and manually edit the token in my configs? Sorry if I'm asking imbecilic questions: :p |
Not at all, you have to go to the URL and retrieve the |
I added the URL step to the |
ok, thank you, got it! should I just entirely replace my original "token:" in the configs? or keep it there and just add the new refreshtoken to it? |
Remove the The |
Also, just a teeny tweak to the message in the script might help out stupid ppl like me, LOL: from: I had assumed the link shown was some sort of returned URL by DropBox that was showing a sort of error in a way, and to go to my browser to login to DropBox. ope! lol |
Good idea, I will update the message 👍 |
So far so good! WEWT!!! TYSM I don't have many heroes, but you've just been added to my list! :p I have them set to run nightly on my cron, if it poops out I'll letcha know! :) Also, none of the following is very important, but would make for very nice feedback enhancements. It seems the backup script waits for all backups to complete before giving any user feedback whatsoever. In the case of backing up many things, including encrypting, sending to DB, etc., it can take a pretty long time, and visually the script/terminal just seems to "hang" with a blinking cursor. It could easily be confused with a freeze. Maybe initially adding something like "performing backup", "encrypting", "sending to DB", etc. as it's performing each step, and then showing the little chart after each backup is complete, rather than a long pause with a big "dump" at the end? Feedback is always nice. :) Just an idea! :) |
Last question tonight so I stop annoying you! lol Has this been fixed yet? #364 |
Nope not yet, at least not that I know of, it's up next :) |
poke @sebastianfeldmann :) |
@sebastianfeldmann
Any chance of getting this fixed pretty soon? The key expires every 4 hours now, meaning adding to a daily cron job always fails, because the key has expired. Then in order to get it working again the user has to go back to their dbox app page, regen an 4hr key, and replace them all in their .json config. For me right now that's 9 locations in the configs. :)
btw, just wanted to add, this is one of the greatest apps ever, lol. Once it's all setup and running smooth, it's soo awesome.
Originally posted by @YouveGotMeowxy in #356 (comment)
The text was updated successfully, but these errors were encountered: