Skip to content

Commit 5bf92fc

Browse files
authored
Document Twitch OAuth2 setup and token management
Added detailed instructions for configuring Twitch OAuth2 credentials and token management for VLX_ChatBridge.
1 parent 4052e08 commit 5bf92fc

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,5 +268,67 @@ Add Browser Sources in OBS pointing to the local server (e.g., `http://localhost
268268
* `vlx.join` : Bot joins your voice channel and starts the SRT stream.
269269
* `vlx.leave`: Bot stops streaming and disconnects.
270270

271+
## Twitch OAuth2 Credentials and Token Configuration
272+
273+
VLX_ChatBridge utilizes the modern Twitch API (Helix) and IRC interfaces. To ensure security and stability, the system uses an **automatic token renewal** mechanism backed by a local database. This means you will only need to generate your tokens manually **once**, and the system will keep them valid indefinitely.
274+
275+
You will need two sets of credentials: the Application credentials and the User Tokens (one for your main broadcaster channel and one for the Bot).
276+
277+
### Step 1: Create the Twitch Application (Client ID & Secret)
278+
These credentials identify your software on Twitch's servers.
279+
1. Go to the [Twitch Developer Console](https://dev.twitch.tv/console) and log in.
280+
2. Click on **"Register Your Application"**.
281+
3. Choose a name for your app (e.g., `VLX_ChatBridge_App`).
282+
4. In **OAuth Redirect URLs**, enter: `http://localhost`
283+
5. In **Category**, select `Chat Bot`.
284+
6. Click "Create". Once created, click "Manage" to get your **Client ID** and generate a **Client Secret**.
285+
7. Insert these two values into the `vlx_chatbridge.conf` file under the `twitch` section.
286+
287+
### Step 2: Generate Tokens (Access & Refresh)
288+
ChatBridge requires explicit authorization to act as both a Bot and the channel owner (e.g., to delete messages for the Auto-Delete feature).
289+
290+
The fastest way to generate the initial tokens is by using a secure site like [Twitch Token Generator](https://twitchtokengenerator.com/):
291+
1. Go to the site and scroll down to the **"Custom Scope Token"** section.
292+
2. You will need to generate **TWO** distinct tokens. Log in to Twitch first with your **Bot** account, and then repeat the process with your **Broadcaster** account (your main channel).
293+
294+
#### Required Permissions (Scopes)
295+
Select the following boxes with extreme care. It is highly recommended to include all these scopes to ensure compatibility with moderation features and future expansions of the bridge:
296+
297+
**For the BOT account (e.g., VirusRoboLox):**
298+
Check these boxes, then click "Generate Token" while logged in with the bot profile:
299+
* `chat:read` (Required to read commands)
300+
* `chat:edit` (Required to reply in chat)
301+
* `channel:moderate` (Required for basic moderation actions)
302+
* `whispers:read` and `whispers:edit` (If the bot uses whispers)
303+
304+
**For the BROADCASTER account (Your main channel):**
305+
Return to the site, check these boxes, and log in with your main account:
306+
* `moderator:manage:chat_messages` (**REQUIRED** for the Auto-Delete command feature to work)
307+
* `channel:read:redemptions` (To intercept Channel Points)
308+
* `channel:manage:broadcast` (To update stream info via commands)
309+
* `channel:read:subscriptions` (To intercept subs via API)
310+
* `moderation:read` (To read chat state)
311+
* `chat:read` and `chat:edit` (For security fallback)
312+
313+
*Note: Once generated, the site will provide two long strings for each account: an `ACCESS TOKEN` and a `REFRESH TOKEN`. Copy them and keep them safe.*
314+
315+
### Step 3: Database Insertion (Automatic Renewal)
316+
To enable automatic renewal, you must insert these initial tokens into the ChatBridge SQLite database (`chatbridge.db` or your configured database).
317+
Open the database (via terminal with `sqlite3` or using a GUI tool like DB Browser for SQLite) and execute this query using your data:
318+
319+
```sql
320+
-- Insert Broadcaster (Owner) Token
321+
INSERT OR REPLACE INTO twitch_credentials (user_id, access_token, refresh_token, expires_at)
322+
VALUES ('BROADCASTER_NUMERIC_ID', 'BROADCASTER_ACCESS_TOKEN', 'BROADCASTER_REFRESH_TOKEN', '2030-01-01 00:00:00');
323+
324+
-- Insert Bot Token
325+
INSERT OR REPLACE INTO twitch_credentials (user_id, access_token, refresh_token, expires_at)
326+
VALUES ('BOT_NUMERIC_ID', 'BOT_ACCESS_TOKEN', 'BOT_REFRESH_TOKEN', '2030-01-01 00:00:00');
327+
```
328+
329+
(Tip: You can find Twitch account numeric IDs using free sites like Twitch Insights or StreamWeasels).
330+
331+
Once inserted, make sure your vlx_chatbridge.conf file has the bot_id: "BOT_NUMERIC_ID" entry configured. From this moment on, ChatBridge will manage the tokens completely autonomously, silently renewing them before they expire. You will never have to repeat this procedure!
332+
271333
## License
272334
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

0 commit comments

Comments
 (0)