How to Manually Configure Twitter Cookies in Agent Reach CLI
Manually configure Twitter cookies in Agent Reach CLI by running agent-reach configure twitter-cookies AUTH_TOKEN CT0 or pasting a raw cookie header, which stores the auth_token and ct0 values in ~/.agent-reach/config.yaml under the keys twitter_auth_token and twitter_ct0 and validates them via the Twitter API.
Agent Reach requires authenticated Twitter/X cookies to enable social media automation capabilities. This guide explains how to manually configure the essential authentication tokens in the Agent Reach CLI, based on the implementation in the Panniantong/Agent-Reach repository. The configuration process writes to your local config file and synchronizes credentials to helper tools automatically.
Understanding Twitter Authentication Requirements
Agent Reach requires two specific authentication tokens from Twitter/X: auth_token and ct0. According to the source code in agent_reach/config.py (lines 22-25), these values map to the configuration keys twitter_auth_token and twitter_ct0 and are persisted in ~/.agent-reach/config.yaml.
Manual Configuration via CLI
The _parse_twitter_cookie_input function in agent_reach/cli.py (lines 24-42) handles both input formats, allowing flexibility in how you supply credentials.
Supplying Cookies as Separate Arguments
Pass the token values as distinct positional arguments:
agent-reach configure twitter-cookies YOUR_AUTH_TOKEN YOUR_CT0_VALUE
Supplying a Raw Cookie Header
Paste the complete cookie string copied from browser DevTools:
agent-reach configure twitter-cookies "auth_token=ABC123; ct0=XYZ789; other=ignored"
Validation and Synchronization Flow
After parsing your input, the _cmd_configure function in agent_reach/cli.py (lines 65-78) writes the values to ~/.agent-reach/config.yaml using Config.set(). It then validates the configuration by executing twitter status via subprocess.run and checking for "ok: true" in the output.
The system synchronizes these credentials to multiple downstream destinations:
- Environment variables: Injects
TWITTER_AUTH_TOKENandTWITTER_CT0for thetwitter-clitool - Legacy xfetch: Writes to
~/.config/xfetch/session.jsonvia_sync_xfetch_sessionincookie_extract.py - Bird CLI: Generates
~/.config/bird/credentials.envvia_sync_bird_env
Automatic Extraction Alternative
While manual configuration provides full control, you can also extract cookies automatically from supported browsers (Chrome, Firefox, Edge, Brave, Opera) using agent-reach configure --from-browser chrome. The configure_from_browser function in agent_reach/cookie_extract.py (lines 18-35) handles this extraction using rookiepy or browser-cookie3, then applies the same synchronization logic.
Summary
- Required tokens:
auth_tokenandct0from Twitter/X. - Config location: Stored in
~/.agent-reach/config.yamlastwitter_auth_tokenandtwitter_ct0. - Manual command:
agent-reach configure twitter-cookiesaccepts either separate arguments or a raw cookie header. - Validation: The CLI automatically tests connectivity via
twitter statusafter configuration. - Sync destinations: Credentials propagate to
twitter-cli,xfetch, andbirdautomatically.
Frequently Asked Questions
What are the exact cookie names required for Agent Reach?
Agent Reach requires exactly two cookies: auth_token and ct0. These are the standard Twitter/X authentication tokens that validate your session. According to the agent_reach/config.py implementation, the CLI stores these as twitter_auth_token and twitter_ct0 in your configuration file.
How do I manually enter Twitter cookies if I don't have browser access?
Use the command agent-reach configure twitter-cookies AUTH_TOKEN CT0 with the values copied from another machine or secure storage. This method does not require local browser access and works on headless servers, writing directly to ~/.agent-reach/config.yaml as implemented in agent_reach/cli.py.
Where does Agent Reach store Twitter cookie configuration?
The cookies are persisted in the YAML configuration file at ~/.agent-reach/config.yaml. The Config class in agent_reach/config.py manages these values, masking sensitive fields when displaying summaries in the terminal.
How does Agent Reach validate my Twitter cookies?
Immediately after configuration, the CLI invokes twitter status through a subprocess and checks the output for "ok: true", as seen in the _cmd_configure implementation in agent_reach/cli.py (lines 65-78). This confirms that the auth_token and ct0 values are valid and active.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →