Commit 7fcabab
Fix Kobo sync failure with newer firmware: add OIDC discovery endpoint and fix OAuth routes (#82)
Newer Kobo firmware performs a full OIDC authentication flow before syncing.
It calls /oauth/.well-known/openid-configuration expecting a standard OIDC
discovery document. Without a dedicated handler, the catch-all /oauth/<path>
route intercepts it and returns OAuth tokens instead, causing an infinite
retry loop.
Changes:
- Add HandleOidcDiscovery() route for /oauth/.well-known/openid-configuration
that returns a proper OIDC discovery document with issuer, token_endpoint,
authorization_endpoint, etc.
- Add /oauth/authorize route to HandleOauthRequest to prevent 308 redirect loop
- Fix make_calibre_web_oauth_response() to return current_user.id instead of
reading user_id from request body (which is always empty on GET requests)
Tested on Kobo firmware 4.45.23640 behind an nginx reverse proxy.
Co-authored-by: new-usemame <248195428+new-usemame@users.noreply.github.com>1 parent 2c848a0 commit 7fcabab
1 file changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1300 | 1300 | | |
1301 | 1301 | | |
1302 | 1302 | | |
1303 | | - | |
| 1303 | + | |
1304 | 1304 | | |
1305 | 1305 | | |
1306 | 1306 | | |
| |||
1322 | 1322 | | |
1323 | 1323 | | |
1324 | 1324 | | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
1325 | 1344 | | |
1326 | 1345 | | |
| 1346 | + | |
1327 | 1347 | | |
1328 | 1348 | | |
1329 | 1349 | | |
| |||
0 commit comments