Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 04-30-2023, 03:29 PM   #1
305869
Connoisseur
305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.
 
Posts: 95
Karma: 28346
Join Date: Mar 2023
Device: Kobo Libra 2, Boox Leaf 7"
How I managed to set up Dropbox cloud sync with KOReader step by step

Maybe it's just me but I found it super complicated to set up Dropbox with KOReader. If you search around you can find these instructions (https://github.com/koreader/koreader...ment-267410178) and they were sufficient to get it set up initially but if you just follow this method after a while your token will expire and it will stop working until you enter a new one manually. I believe there used to be a long-lived token that allowed you to leave it at that but now more work is needed. So I just wanted to explain how I managed to get Dropbox cloud sync for reading statistics working in April of 2023.

1. Made sure I was logged into my Dropbox account. I went to https://www.dropbox.com/developers/apps and created an app. You can give it any name, but the name must be unique.
- Under Choose an API I selected Scoped access
- Under Type of access I selected Full Dropbox.

2. In the app console, I went to permissions and I gave it pretty much all permissions. Screenshot - https://i.imgur.com/sBmMq54.png
- I do not think you need all of these. But while troubleshooting I just enabled all of them in case, and since I only use this dropbox account for reading statistics syncing I felt comfortable doing this.

3. At this point the instructions above tell you to use the Generate token button in the app console settings tab and enter that in KOReader. This will work but only for a few hours, until the token expires. What you need is a refresh token (short, doesn't start with sl.) and your app key and app secret so that KOReader can request a new token every time one is needed to synchronise data.
- The app key and app secret can be found in the settings tab of the app console.

4. Request an authorization code. In the app console, on the settings tab in the OAuth 2 section, I added this URL to the Redirect URI: https://www.dropbox.com/oauth2/autho...s_type=offline (replacing APPKEYHERE with the app key). After adding it I pasted the URL in my browser and pressed "allow" on all the prompts. This will return an authorization code which is needed to obtain a refresh token.
- Note that the URI is being automatically shortened in this post

5. Request a refresh token using curl. Using the terminal I obtained a refresh token with this command:
Code:
curl https://api.dropbox.com/oauth2/token \
-d code=AUTHORIZATION_CODE \
-d grant_type=authorization_code \
-u APP_KEY:APP_SECRET
- Replace AUTHORIZATION_CODE with the code obtained in step 4.
- Replace APP_KEY:APP_SECRET with your key and secret separated by a colon
- In the terminal you get a response with various parameters. The important one is called refresh_token. I copied this code to enter in KOReader.

6. In KOReader, I went to Menu > Tools > Reading Statistics > Settings > Cloud sync. Here I pressed Add Service, and selected Dropbox for type.
- In displayed name, I entered the name of my app that I chose in step 1.
- In the second field (dropbox refresh token or long-lived token) I entered the token obtained in step 5.
- In the third field (<APP_KEY>:<APP_SECRET>) I entered the app key and secret separated by a colon.
- The fourth field I left blank (I think I tried "/" for root first but this didn't work)

Note: This is easier to do in a text editor. You may add any value to these fields, save and then plug your reader in and edit the cloudstorage.lua file found in koreader/settings with any editor so you can paste in the token and app key/secret to avoid mistakes. The file looks like this:
Code:
-- we can read Lua syntax here!
return {
    ["cs_servers"] = {
        [1] = {
            ["address"] = "<app_key>:<app_secret>",
            ["name"] = "<app name>",
            ["password"] = "<refresh token>",
            ["type"] = "dropbox",
            ["url"] = "",
        },
    },
}
After this everything worked for me. I wanted to write it up for my own benefit in case I need to do this again some years later and forget how to and I thought I might as well post it here in case anyone else is pulling their hair out trying to figure out how to get a "short-lived refresh token"

Troubleshooting
I had an issue where Dropbox was working and I could access and download files but reading statistics sync wasn't working. This was fixed by going to Menu > Tools > Reading statistics > Settings > Cloud sync > Edit, then press the Dropbox service name and long press "Long-press to choose current folder" to set the folder. Other issues were fixed by doing a device restart.

Sources
https://github.com/koreader/koreader...ment-267410178
https://github.com/koreader/koreader/issues/9861
https://www.dropboxforum.com/t5/Drop...en/td-p/596739

Last edited by 305869; 04-30-2023 at 06:23 PM. Reason: added sources
305869 is offline   Reply With Quote
Old 04-30-2023, 06:15 PM   #2
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,693
Karma: 730679
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Quote:
Originally Posted by 305869 View Post
Maybe it's just me
No, Dropbox just made life really difficult in the meantime. What you linked is from 2016 and that's how simple it once was.
Frenzie is offline   Reply With Quote
Advert
Old 04-30-2023, 06:40 PM   #3
305869
Connoisseur
305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.
 
Posts: 95
Karma: 28346
Join Date: Mar 2023
Device: Kobo Libra 2, Boox Leaf 7"
Quote:
Originally Posted by Frenzie View Post
No, Dropbox just made life really difficult in the meantime. What you linked is from 2016 and that's how simple it once was.
Yes, I gathered that there were some changes with the Dropbox API that complicated things. I am really not good at this developer stuff so it took me a long time to work everything out. Maybe that's not the case for most people on here but hopefully this can help someone else who is a more casual user like me.
305869 is offline   Reply With Quote
Old 05-01-2023, 12:24 AM   #4
hius07
Wizard
hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.
 
Posts: 1,099
Karma: 3592591
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
Some useful links can be found in the first post of
https://github.com/koreader/koreader/pull/9496
hius07 is online now   Reply With Quote
Old 05-09-2023, 01:39 PM   #5
jedi34567
Junior Member
jedi34567 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2023
Device: Kobo Sage
Can see Dropbox files but downloading is failing intermittently

Thank you for the tutorial on getting Dropbox configured! It worked for me, sort of. I can see the Dropbox files and navigate the directories.

I was able to download some files via Dropbox to my Kobo KOReader, but other files gave me an error. The ones I successfully downloaded were small, the ones that failed were bigger than 1MB. All the permissions, etc., were identical.

Any ideas on what could be wrong?

So close!
jedi34567 is offline   Reply With Quote
Advert
Old 05-09-2023, 05:05 PM   #6
305869
Connoisseur
305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.
 
Posts: 95
Karma: 28346
Join Date: Mar 2023
Device: Kobo Libra 2, Boox Leaf 7"
Quote:
Originally Posted by jedi34567 View Post
Thank you for the tutorial on getting Dropbox configured! It worked for me, sort of. I can see the Dropbox files and navigate the directories.

I was able to download some files via Dropbox to my Kobo KOReader, but other files gave me an error. The ones I successfully downloaded were small, the ones that failed were bigger than 1MB. All the permissions, etc., were identical.

Any ideas on what could be wrong?

So close!
I'm sorry, I have no idea what could cause this. I tested downloading a 40MB image from my dropbox using KOReader and it worked as expected. What was the error message?
305869 is offline   Reply With Quote
Old 05-12-2023, 04:19 PM   #7
jedi34567
Junior Member
jedi34567 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2023
Device: Kobo Sage
Quote:
Originally Posted by 305869 View Post
I'm sorry, I have no idea what could cause this. I tested downloading a 40MB image from my dropbox using KOReader and it worked as expected. What was the error message?
I get "Could not save file to /mnt/onboard/ebooks/name_of_book.epub". I get intermittent messages about connecting to the wifi while in the "Cloud Storage" area. I wonder if the wifi is disconnecting during the longer downloads?
jedi34567 is offline   Reply With Quote
Old 05-12-2023, 04:35 PM   #8
jedi34567
Junior Member
jedi34567 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2023
Device: Kobo Sage
Smile Dropbox access SOLVED!

It _was_ the wifi. I connected to an access point closer to the Kobo and the Dropbox downloads started working for all files.

Note that this is KOReader problem, the native software was able to deal with the poorer wifi connection.
jedi34567 is offline   Reply With Quote
Old 05-12-2023, 05:37 PM   #9
305869
Connoisseur
305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.305869 solves Fermat’s last theorem while doing the crossword.
 
Posts: 95
Karma: 28346
Join Date: Mar 2023
Device: Kobo Libra 2, Boox Leaf 7"
I'm glad you sorted it out
305869 is offline   Reply With Quote
Old 06-08-2023, 06:00 PM   #10
Bertop08
Junior Member
Bertop08 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jun 2023
Device: Libra 2
Almost done, but...

I completed every single task, I even reset the Refresh token. But on my Libra it indicates that it "cannot fetch list of folder contents. Please check your configuration or network connection". The wifi is fine.

I really don't know what's wrong. Maybe the directory? Like you, I left the value empty. What does "dropbox URL" precisely mean?

Would you have any advice on that? I'm lost!

Thanks in advance,
Mathis
Bertop08 is offline   Reply With Quote
Old 06-08-2023, 06:41 PM   #11
Bertop08
Junior Member
Bertop08 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jun 2023
Device: Libra 2
[solved]

That's it !
I forgot to activate the permissions in the Dropbox App Settings. Now it's all working fine!

To find the downloaded files in Koreader, you'll need to activate "Show hidden files", and they're gonna be in /.kobo/dropbox.

Cheers,
And long live free code.
Bertop08 is offline   Reply With Quote
Old 08-23-2023, 08:30 AM   #12
Vakke
Enthusiast
Vakke doesn't litterVakke doesn't litter
 
Posts: 32
Karma: 164
Join Date: Oct 2021
Location: Finland
Device: Kobo Libra 2
I've done everything excatly as instructed and done all the possible troubleshootings but Koreader still just sends a message of "Cannot fetch list of folder contents."

Is there anything which can go under the radar or is Dropbox just not working anymore?
Vakke is offline   Reply With Quote
Old 08-23-2023, 09:12 AM   #13
hius07
Wizard
hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.
 
Posts: 1,099
Karma: 3592591
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
Quote:
Originally Posted by Vakke View Post
I've done everything excatly as instructed and done all the possible troubleshootings but Koreader still just sends a message of "Cannot fetch list of folder contents."

Is there anything which can go under the radar or is Dropbox just not working anymore?
Please try to enter your Dropbox cloud storage and show me koreader/crash.log after that.
hius07 is online now   Reply With Quote
Old 08-23-2023, 10:36 AM   #14
Vakke
Enthusiast
Vakke doesn't litterVakke doesn't litter
 
Posts: 32
Karma: 164
Join Date: Oct 2021
Location: Finland
Device: Kobo Libra 2
Quote:
Originally Posted by hius07 View Post
Please try to enter your Dropbox cloud storage and show me koreader/crash.log after that.
08/23/23-16:32:24 INFO Dropbox: cannot get access token
08/23/23-16:32:24 ERROR CloudStorage: nil

This is the message

I have to say I don't understand what that means at this stage. I've done exactly everything as it is in the first post and also troubleshooted throught the linked GitHub pages.

I'm using the correct app key and app secret. I used Mac terminal to get refresh token which I'm using as told and I've tried all the folder settings suggested. I've also named the app as I've named it from the Dropbox app site.

I've tried this from the Kobo Libra 2 KOReader and then I've also tried to do the same thing editing the lua straight from the root and both give me the same message.

Last edited by Vakke; 08-23-2023 at 11:19 AM.
Vakke is offline   Reply With Quote
Old 08-23-2023, 11:19 AM   #15
hius07
Wizard
hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.
 
Posts: 1,099
Karma: 3592591
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
Quote:
Originally Posted by Vakke View Post
08/23/23-16:32:24 INFO Dropbox: cannot get access token
08/23/23-16:32:24 ERROR CloudStorage: nil

This is the message
That means that the short lived token is not generated.
The reasons may be: incorrect refresh token, incorrect app_key, incorrect app_secret (they must be entered with : colon).
Or you entered them into the wrong fields in the cloud storage edit dialog.
hius07 is online now   Reply With Quote
Reply

Tags
dropbox


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install & set up Calibre Companion? Step-by-step instructions DanielLauJJ Calibre Companion 0 03-28-2019 01:09 PM
Excel VBA: Programming For Complete Beginners, Step-By-Step Illustrated Guide WilliamBSkates Self-Promotions by Authors and Publishers 1 10-20-2018 12:51 PM
Mac OSX: Idiot-Proof Font Scaling Fix [Step-by-step] Jelbee Kobo Reader 2 06-14-2010 01:16 PM
Step by step: How to borrow library books via Overdrive on the prs-600 ebooker Sony Reader 3 11-14-2009 11:25 AM


All times are GMT -4. The time now is 01:42 AM.


MobileRead.com is a privately owned, operated and funded community.