Skip to content

docs(proposal): Invisible Firefox auth_token extractor helper#427

Draft
feder-cr wants to merge 1 commit into
d60:mainfrom
feder-cr:proposal-invisible-firefox-auth-helper
Draft

docs(proposal): Invisible Firefox auth_token extractor helper#427
feder-cr wants to merge 1 commit into
d60:mainfrom
feder-cr:proposal-invisible-firefox-auth-helper

Conversation

@feder-cr

@feder-cr feder-cr commented May 27, 2026

Copy link
Copy Markdown

opening as draft to check interest before building the helper module.

would an optional browser-based auth_token extractor helper be in scope? a small module that performs the X login flow in a real stealth browser once, then writes cookies to a file that twikit's existing load_cookies reads directly. no change to twikit's HTTP core.

motivation: ToProtectYourAccount.md already recommends save_cookies / load_cookies to avoid repeated login calls. the first login still needs to happen somewhere, and X's login flow now requires JS challenges (Castle Token, ondemand.s.js fingerprinting) that pure HTTP can't pass cleanly. relevant open PRs: #324, #393, #410.

the helper would wrap feder-cr/invisible_playwright, which drives a patched Firefox 150 (feder-cr/invisible_firefox, MPL-2, same license as Firefox upstream, fingerprint patches at the C++ source level). optional dependency, only loaded when the helper is imported.

this PR only adds a proposal doc at the repo root so the idea has somewhere concrete to land. tracking discussion: #426

if not in scope i'll close without noise.

Summary by Sourcery

Documentation:

  • Document a draft design for an optional twikit.helpers.invisible_firefox module that automates X login in a stealth Firefox browser and saves cookies for later reuse.

Adds a draft proposal for an optional browser-based auth_token extractor
helper that lets users log in once via a stealth browser, then twikit's
existing load_cookies consumes the resulting cookies.json. No change to
HTTP core. Opened as draft to check interest before building.
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 95e8c074-58fc-436e-81ff-50be66dddd8b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai

sourcery-ai Bot commented May 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a new proposal document describing an optional Invisible Firefox-based helper module for performing X login in a real browser and exporting cookies for use with existing twikit cookie loading APIs, without modifying the core HTTP logic.

Sequence diagram for Invisible Firefox auth_token extraction helper usage

sequenceDiagram
  actor User
  participant Helper as invisible_firefox.login_to_cookies
  participant Playwright as invisible_playwright
  participant Firefox as InvisibleFirefoxBrowser
  participant X as X
  participant Client as Client

  User ->> Helper: login_to_cookies(username, email, password, output)
  Helper ->> Playwright: launch_stealth_browser()
  Playwright ->> Firefox: start_patched_firefox()
  Firefox ->> X: navigate_to_login()
  Firefox ->> X: submit_credentials()
  X -->> Firefox: auth_token_and_cookies
  Firefox -->> Helper: browser_cookies
  Helper ->> Helper: write_cookies_file(output)

  User ->> Client: Client(language)
  User ->> Client: load_cookies(output)
Loading

File-Level Changes

Change Details Files
Document a proposal for an optional Invisible Firefox-based auth_token extractor helper that drives a stealth Firefox via invisible_playwright and writes cookies for twikit to consume.
  • Introduce a top-level markdown proposal outlining the goal of a browser-based login helper that produces cookies consumable by twikit’s existing load_cookies API.
  • Describe the motivation around X’s JS-based login challenges and link to related open PRs touching authentication and login flows.
  • Specify the proposed helper module name, usage example, and how it integrates with invisible_playwright/invisible_firefox as an optional dependency.
  • Clarify non-goals such as avoiding any change to twikit’s HTTP core or existing login/cookie APIs and delegating backend issues to the invisible_playwright project.
  • Outline minimal maintenance expectations for the repo, limited to the helper wrapper and documentation entry.
INVISIBLE_FIREFOX_AUTH_PROPOSAL.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@feder-cr

feder-cr commented Jun 6, 2026

Copy link
Copy Markdown
Author

@d60 any interest in the optional browser-based auth_token extractor? opt-in, doesn't touch the default flow. glad to close if not useful.

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