Skip to content
This repository was archived by the owner on Aug 26, 2026. It is now read-only.

Creating session tokens

Zed edited this page Nov 16, 2025 · 8 revisions

Warning

Running a large public instance is difficult, and is not feasible with a small amount of accounts. If you'd like to run one, consider reaching out to @zedeus:nolog.chat (Matrix) or zedeus@pm.me (email) for assistance with getting started.

Nitter requires real accounts to authenticate API requests. The sessions are loaded from sessions.jsonl in the directory where the nitter binary is. You can overwrite this by setting the environment variable NITTER_SESSIONS_FILE.

JSONL, aka NDJSON, is the only supported format. The filename must end in .jsonl. The file should look like this:

{"kind": "cookie", "auth_token": "...", "ct0": "...", "username": "...", "id": "..."}
{"kind": "cookie", "auth_token": "...", "ct0": "...", "username": "...", "id": "..."}

Note that username and id are optional, but they make it easier to troubleshoot and monitor your sessions.

Using get_web_session.py

To create a session, use the get_web_session.py script in the tools/ directory:

pip install -r requirements.txt
python3 get_web_session.py <username> <password> [totp_secret] --append ../sessions.jsonl

The script handles 2FA automatically if a TOTP secret is provided. The secret is the base32 string provided by x.com during 2FA setup, accessible by clicking "can't scan" on the QR code page. If you already have 2FA setup, copy the secret from your authenticator app, or disable 2FA and set it up again.

You can now run Nitter and should see:

[sessions] Parsing JSONL account sessions file: ./sessions.jsonl
[sessions] Successfully added 1 valid account sessions.

For multiple accounts, simply run the script again. It's a good idea to use proxies/VPNs if creating many sessions, but it's unknown how much this affects your risk of getting banned.

nitter

Clone this wiki locally