View Single Post
Old 09-12-2024, 01:52 PM   #210
dhdurgee
Guru
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 910
Karma: 3000002
Join Date: Jun 2010
Device: K3W, PW4
Quote:
Originally Posted by spicefather View Post
I've been playing around with this a little bit and it looks like as Pjama suggested, they changed their security a little bit. I tried generating a new auth token in the app via the clone code and that didn't work for me, but I did the same in my browser and copied its auth token into this plugin's config and that worked perfectly.
No promises on timeline since I have limited time to work on this, but I'm going to see if I can work the newer token generation method into the plugin. Alternatively if anyone is interested in working on it I'm happy to share my findings so far.

If anyone needs to get their plugin working, you can follow the steps below. I don't know how long this lasts for, so you may end up needing to redo it after some hours/days. Also the instructions are based on Firefox, hopefully they apply to other browsers as well but if not just ask and someone will try to help out.

1. In your browser, open your dev console (ctrl-shift-I or F12 for me).
2. Go to the network tab, click the cog at the top-right and make sure "Persist Logs" is on.
3. Go to https://libbyapp.com/.
4. In the dev console, type "sentry" into the filter bar.
5. Click on the furthest-down entry that is a "GET" request.
6. In the right panel, go into the "Request Headers" and find "Authorization" -- its format should be "Bearer" followed by a long string of characters. Copy just the long string.
7. Make sure Calibre is closed, and open the plugin config file (%APPDATA%\calibre\plugins\overdrive_libby.json on Windows, unsure Mac/Linux paths).
8. Find the line for "libby_token", and replace its value with the one you copied in step 6.
9. Open Calibre and the plugin should work as expected now.

Hopefully this is helpful to people.
I tried this out today and unfortunately ran into what appears to be another error:

Spoiler:
calibre, version 7.16.0
ERROR: Unhandled exception: <b>ClientConnectionError</b>: Error synchronizing data<p>Check your connection or retry in a few minutes.</p>

calibre 7.16 embedded-python: True
Linux-6.8.0-44-generic-x86_64-with-glibc2.39 Linux ('64bit', 'ELF')
('Linux', '6.8.0-44-generic', '#44-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 13 13:35:26 UTC 2024')
Python 3.11.5
Interface language: None
EXE path: /opt/calibre/bin/calibre
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (10, 0, 3) && Hyphenate This! (0, 1, 3) && OverDrive Libby (0, 1, 9)
Traceback (most recent call last):
File "urllib/request.py", line 1348, in do_open
File "http/client.py", line 1286, in request
File "http/client.py", line 1332, in _send_request
File "http/client.py", line 1281, in endheaders
File "http/client.py", line 1041, in _send_output
File "http/client.py", line 979, in send
File "http/client.py", line 1458, in connect
File "ssl.py", line 517, in wrap_socket
File "ssl.py", line 1108, in _create
File "ssl.py", line 1379, in do_handshake
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'sentry-read.svc.overdrive.com'. (_ssl.c:1006)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre_plugins.overdrive_libby.libby.client" , line 518, in send_request
response = req_opener.open(req, timeout=self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "urllib/request.py", line 519, in open
File "urllib/request.py", line 536, in _open
File "urllib/request.py", line 496, in _call_chain
File "urllib/request.py", line 1391, in https_open
File "urllib/request.py", line 1351, in do_open
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'sentry-read.svc.overdrive.com'. (_ssl.c:1006)>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "calibre_plugins.overdrive_libby.workers", line 351, in run
synced_state = libby_client.sync()
^^^^^^^^^^^^^^^^^^^
File "calibre_plugins.overdrive_libby.libby.client" , line 631, in sync
res: Dict = self.send_request("chip/sync")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "calibre_plugins.overdrive_libby.libby.client" , line 556, in send_request
raise ClientConnectionError(
calibre_plugins.overdrive_libby.libby.errors.Clien tConnectionError: <calibre_plugins.overdrive_libby.libby.errors.Clie ntConnectionError; http_status=0, msg='URLError <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'sentry-read.svc.overdrive.com'. (_ssl.c:1006)>', error_response='''>


This appears to be some sort of an SSL certificate error.

Dave

PS: got this fixed with guidance from:
https://github.com/ping/libby-calibre-plugin/issues/33

Last edited by dhdurgee; 09-12-2024 at 02:08 PM. Reason: add solution
dhdurgee is offline   Reply With Quote