Skip to content

feat(auth): add Zen browser cookie extraction - #95

Open
aditya-gupta-dev wants to merge 1 commit into
jackwener:mainfrom
aditya-gupta-dev:feat/zen-browser
Open

aditya-gupta-dev wants to merge 1 commit into
jackwener:mainfrom
aditya-gupta-dev:feat/zen-browser

Conversation

@aditya-gupta-dev

Copy link
Copy Markdown
Contributor

Summary

Add Zen browser support for Twitter/X cookie authentication.

Zen users can now authenticate using their existing browser session and prioritize Zen with:

TWITTER_BROWSER=zen twitter whoami

Changes

  • Reuse the existing Firefox cookie reader for Zen profiles.
  • Discover profiles on Linux, macOS, and Windows, including Linux Flatpak installations.
  • Support $XDG_CONFIG_HOME/zen, falling back to ~/.config/zen, plus ~/.zen.
  • Read profiles.ini and prefer the install default over the legacy Default=1 profile, following Firefox’s behavior.
  • Support absolute profile paths and scan remaining profiles when earlier profiles fail or lack authentication cookies.
  • Apply Zen support to both in-process extraction and the subprocess fallback.
  • Preserve full Twitter cookie forwarding.
  • Update browser selection documentation and authentication error messages.

Zen is appended to the existing browser order. TWITTER_BROWSER=zen tries Zen first while retaining fallback to other browsers. Environment-variable authentication keeps its existing priority.

Validation

  • uv run pytest -q: 252 passed, 6 deselected.
  • uv run ruff check .: passed.
  • uv run mypy twitter_cli: passed.
  • Confirmed authentication cookies and the full cookie header are extracted from a local Zen profile.

Regression tests cover platform-specific profile discovery, XDG configuration paths, default-profile priority, absolute paths, multiple profiles, missing profiles, and both extraction paths.

Discover Zen profiles across Linux, Flatpak, macOS, and Windows, including XDG config locations. Follow Firefox profile selection by preferring the install default from profiles.ini and supporting absolute profile paths.

Read Zen cookies using the Firefox loader in both extraction paths. Add browser priority support, documentation, and regression coverage.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant