Files
PleasePrompto 841164ab93 Major authentication reliability fix: Hybrid approach + Chrome + Anti-detection
Implements robust auth strategy based on MCP Server TypeScript implementation:

Auth Architecture Changes:
- Hybrid auth: persistent browser profile (user_data_dir) + manual cookie injection
- Fixes Playwright bug #36139: Session cookies now persist correctly
- Real Chrome via channel="chrome" instead of Chromium (cross-platform reliability)
- Remove automation detection: ignore_default_args=["--enable-automation"]
- Manual cookie injection from state.json for session cookie persistence

Technical Details:
- Python's launch_persistent_context doesn't support storage_state parameter (unlike TypeScript)
- Workaround: Launch with user_data_dir, then manually inject cookies via context.add_cookies()
- Browser profile stores: fingerprint + persistent cookies + cache
- state.json stores: ALL cookies including session cookies (expires=-1)
- This ensures both consistent fingerprinting AND reliable session cookie persistence

Files Changed:
- scripts/ask_question.py: Add hybrid auth + ignore_default_args
- scripts/auth_manager.py: Update setup_auth() and validate_auth() with new approach
- scripts/setup_environment.py: Install Chrome instead of Chromium
- requirements.txt: Add Chrome installation note
- README.md: Add Chrome installation section with rationale
- AUTHENTICATION.md: NEW - Complete auth architecture documentation

Why This Fixes Issue #2:
- Session cookies (without Expires) were lost on restart (Playwright bug)
- Chromium had cross-platform reliability issues
- Manual cookie injection ensures session cookies persist
- Real Chrome ensures consistent behavior across systems

References:
- Playwright Issue #36139: Session cookies not persisting
- Playwright Issue #14949: storage_state with persistent context
- Based on: notebooklm-mcp TypeScript implementation
2025-10-20 15:21:09 +02:00
..