# How to Manually Configure Twitter Cookies in Agent Reach CLI

> Learn to manually configure Twitter cookies in Agent Reach CLI by running a simple command or pasting a raw cookie header. Securely store your authorization tokens for seamless agent reach integration with the Twitter API.

- Repository: [Pnant/Agent-Reach](https://github.com/Panniantong/Agent-Reach)
- Tags: how-to-guide
- Published: 2026-07-04

---

**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`](https://github.com/Panniantong/Agent-Reach/blob/main/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`](https://github.com/Panniantong/Agent-Reach/blob/main/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:

```bash
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:

```bash
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`](https://github.com/Panniantong/Agent-Reach/blob/main/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_TOKEN` and `TWITTER_CT0` for the `twitter-cli` tool
- **Legacy xfetch**: Writes to `~/.config/xfetch/session.json` via **`_sync_xfetch_session`** in [`cookie_extract.py`](https://github.com/Panniantong/Agent-Reach/blob/main/cookie_extract.py)
- **Bird CLI**: Generates `~/.config/bird/credentials.env` via **`_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`](https://github.com/Panniantong/Agent-Reach/blob/main/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_token` and `ct0` from Twitter/X.
- **Config location**: Stored in `~/.agent-reach/config.yaml` as `twitter_auth_token` and `twitter_ct0`.
- **Manual command**: `agent-reach configure twitter-cookies` accepts either separate arguments or a raw cookie header.
- **Validation**: The CLI automatically tests connectivity via `twitter status` after configuration.
- **Sync destinations**: Credentials propagate to `twitter-cli`, `xfetch`, and `bird` automatically.

## 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`](https://github.com/Panniantong/Agent-Reach/blob/main/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`](https://github.com/Panniantong/Agent-Reach/blob/main/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`](https://github.com/Panniantong/Agent-Reach/blob/main/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`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py) (lines 65-78). This confirms that the `auth_token` and `ct0` values are valid and active.