Explain why Cloudflare can still 403 after pasting cookies and User-Agent (#34) - #39
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.0%) is below the target coverage (70.0%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #39 +/- ##
=======================================
- Coverage 78.9% 78.7% -0.2%
=======================================
Files 28 28
Lines 2401 2407 +6
Branches 436 436
=======================================
Hits 1895 1895
- Misses 393 399 +6
Partials 113 113
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34.
What's broken
A user (@Peeel in #34) pasted their Brave cookies and matching User-Agent exactly as the README instructed, and the sync still failed every run with this error in the log:
The error says "try providing raw cookies", but they already had. That's a dead end for the user, they have no idea what to do next, and the README's "Cloudflare issues" section stops at "paste cookies and UA" too, so there's nowhere to look it up.
Why it happens
Cloudflare's
cf_clearancehas three constraints beyond cookie value + User-Agent that the error message and README never spelled out:cf_clearanceto the IP address that solved the challenge, not just the UA. If Jellyfin's egress IP differs from the browser's (different machine, VPN, mobile tether, datacenter), the token is rejected even though the cookie is correct.cf_clearancefrom a managed challenge often expires in about 30 minutes. A token pasted in advance can be dead by the time the scheduled sync actually runs.The maintainer reply in #34 lays out all three, this PR just lifts that explanation into the code and the docs so future users don't have to find the issue thread.
What this PR does
LetterboxdSync/LetterboxdScraper.cs: rewrote the TMDb 403 exception message. Instead of "Try providing raw cookies." (which the user has already done) it now names the three likely causes and points at the README section by name.README.md: added a new "Still 403ing after pasting Raw Cookies and a matching User-Agent" subsection under "Cloudflare issues", explaining the three causes in plain English with a concrete fix per cause ("paste fresh cookies from a browser on the same network as the Jellyfin server", "trigger the sync immediately rather than waiting for the scheduled run", "there isn't much the plugin can do about this one"). Dropped the now-duplicate "the cookie expires periodically" line, the new subsection covers it.Not touched on purpose:
GetWatchlistTmdbIdsAsyncandGetDiaryFilmEntriesAsync, the sign-in 403 inLetterboxdAuth.cs, and the dashboard JS error inuserPage.html. They have the same "try raw cookies" framing and would benefit from the same rewrite, but the change set is kept tight to the path that fired in the issue's log. Easy follow-up.How to test
dotnet build -c Releaseclean (build succeeded, only pre-existing test-project warnings).dotnet test -c Releasepasses 431/431 in 35s, same as main. No test referenced the old exception string.Follow-ups (not in this PR)
LetterboxdScraper.cspartial-results log lines,LetterboxdAuth.cs:118sign-in 403, and the "Blocked by Cloudflare. Try adding Raw Cookies with cf_clearance." string inuserPage.html.