-
-
Notifications
You must be signed in to change notification settings - Fork 106
Cookie Validation Issue #259
Description
It appears that Patron has changed the domain for session_id cookie, so the validator is failing to find session_id and erroring. Session id is now using www.patreon.com on my end instead of .patreon.com like all the other cookies.
2025-03-14 15:25:40.1908 FATAL [PatreonDownloader.App.Program] Fatal error, application will be closed: UniversalDownloaderPlatform.Common.Exceptions.CookieValidationException: session_id cookie not found at PatreonDownloader.Implementation.PatreonCookieValidator.ValidateCookies(CookieContainer cookieContainer) in M:\Downloaders\PatreonDownloader\Dev\PatreonDownloader.Implementation\PatreonCookieValidator.cs:line 34 at UniversalDownloaderPlatform.Engine.UniversalDownloader.Download(String url, IUniversalDownloaderPlatformSettings settings) in M:\Downloaders\PatreonDownloader\Dev\submodules\UniversalDownloaderPlatform\UniversalDownloaderPlatform.Engine\UniversalDownloader.cs:line 181 at PatreonDownloader.App.Program.RunPatreonDownloader(CommandLineOptions commandLineOptions) in M:\Downloaders\PatreonDownloader\Dev\PatreonDownloader.App\Program.cs:line 128 at PatreonDownloader.App.Program.Main(String[] args) in M:\Downloaders\PatreonDownloader\Dev\PatreonDownloader.App\Program.cs:line 68
Here is a view of the SQLite db for my instance of Chrome that the downloader is managing.

The fix (while maintaining the validation check), would be to just combine the cookies for the two domains before validating.
In PatreonDownloader.Implementation\PatreonCookieValidator.cs I just added the one line below to combine the two domains cookie sets before the validation check.
CookieCollection cookies = cookieContainer.GetCookies(new Uri("https://patreon.com"));
cookies.Add(cookieContainer.GetCookies(new Uri("https://www.patreon.com"))); // added this, combine the two domains cookies for validation checks
if (cookies["__cf_bm"] == null)
throw new CookieValidationException("__cf_bm cookie not found");
if (cookies["session_id"] == null)
throw new CookieValidationException("session_id cookie not found");
if (cookies["patreon_device_id"] == null)
throw new CookieValidationException("patreon_device_id cookie not found");Doing the above fixes the issue on my end and the downloader is working fine after that.