This repository was archived by the owner on Aug 26, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Creating session tokens
Zed edited this page Feb 5, 2025
·
8 revisions
Nitter requires real accounts to authenticate API requests. The credentials are by default loaded from sessions.jsonl in the directory where the nitter binary is. You can overwrite this by setting the NITTER_SESSIONS_FILE environment variable.
JSONL, aka NDJSON, is the only supported format. The filename must end in .jsonl, otherwise an error is thrown. The file should look like this:
{"oauth_token": "...", "oauth_token_secret": "..."}
{"oauth_token": "...", "oauth_token_secret": "..."}
{"oauth_token": "...", "oauth_token_secret": "..."}To create a session, you can use the get_session.py script in this repo.
# assuming you're in the root nitter folder
cd tools
python3 -m venv venv && source venv/bin/activate # optional
pip install pyotp requests
python get_session.py <username> <password> <2fa secret> ../sessions.jsonlYou can now run Nitter, and you should see the following:
[sessions] Parsing JSONL account sessions file: ./sessions.jsonl
[sessions] Successfully added 1 valid account sessions.
If you have more than one account, you can run the script again, though it's recommended to run this through a proxy/VPN if you're planning to create many sessions.
nitter