Get Your Twitch OAuth Token¶
Step 1: Authorize Your App¶
Click this link to generate your OAuth token:
⚠️ IMPORTANT: Updated with EventSub chat scopes (user:read:chat, user:write:chat, user:bot, channel:bot) for TwitchIO v3 compatibility.
Alternative: Web Interface OAuth (Recommended)¶
StarStreamer v0.6.1+ includes a web interface with integrated OAuth flow:
- Start StarStreamer:
uv run python src/main.py - Open the web interface at http://localhost:8888
- Navigate to the Connections page
- Click the Twitch authorization button
- Complete OAuth flow on Twitch's website
- Token is automatically captured and stored securely
This method is more user-friendly and handles token storage automatically.
Step 2: Manual Authorization (Alternative Method)¶
- Click the link above
- Log in to Twitch if needed
- Click "Authorize" to grant all permissions
- You'll be redirected to
http://localhost:3000#access_token=YOUR_TOKEN&scope=... - Copy the token from the URL (everything between
access_token=and&scope=)
Step 3: Store Your Token¶
StarStreamer uses implicit OAuth flow for security and simplicity:
- No client secret required - Public clients don't need client secrets
- Database token storage - Tokens are stored securely in StarStreamer's database via VariableRepository
- No config file tokens - This prevents accidental commits of sensitive credentials
Configure Your Channel¶
Update your config.yaml file with your channel information:
twitch:
client_id: "h1x5odjr6qy1m8sesgev1p9wcssz63" # Default StarStreamer public client
channel: "YOUR_CHANNEL_NAME"
Or use environment variable substitution:
twitch:
client_id: "${TWITCH_CLIENT_ID:-h1x5odjr6qy1m8sesgev1p9wcssz63}"
channel: "${TWITCH_CHANNEL}"
Note: You only need to set channel - StarStreamer will automatically fetch your broadcaster ID from your channel name.
Token Storage¶
The OAuth token from Step 2 will be automatically stored in StarStreamer's database when you first run the application. This secure storage approach: - Prevents accidental token commits to version control - Allows for future token refresh capabilities - Keeps sensitive credentials separate from configuration files
Step 4: Optional - Manual Broadcaster ID (Advanced)¶
If needed, you can manually set your broadcaster ID to override auto-fetch:
twitch:
client_id: "h1x5odjr6qy1m8sesgev1p9wcssz63"
channel: "YOUR_CHANNEL_NAME"
broadcaster_id: "YOUR_TWITCH_USER_ID"
Or with environment variables:
twitch:
client_id: "${TWITCH_CLIENT_ID:-h1x5odjr6qy1m8sesgev1p9wcssz63}"
channel: "${TWITCH_CHANNEL}"
broadcaster_id: "${TWITCH_BROADCASTER_ID}"
To get your broadcaster ID manually:
- Go to: https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/
- Enter your Twitch username
- Copy the User ID
Or use the Twitch CLI:
All Required Scopes¶
Your token will have these permissions:
- ✅ Chat (EventSub/Helix): user:read:chat, user:write:chat - Read and send messages via EventSub/Helix API
- ✅ Bot Permissions: user:bot, channel:bot - Required for bot operations with EventSub
- ✅ Channel Points: Read and manage redemptions
- ✅ Subscriptions: Read sub events
- ✅ Bits: Read cheer events
- ✅ Hype Train: Read hype train events
- ✅ Moderation: channel:moderate, moderation:read - Receive ban/unban events and general moderation
- ✅ Banned Users: moderator:read:banned_users - Read banned user information
- ✅ Shield Mode: Manage shield mode
- ✅ Shoutouts: Create and receive shoutouts
- ✅ VIPs: Read and manage VIPs
- ✅ Polls: Read and manage polls
- ✅ Predictions: Read and manage predictions
- ✅ Goals: Read channel goals
- ✅ Clips: Create clips
- ✅ Markers: Create stream markers
- ✅ Commercials: Run ads
Note: The old IRC scopes (chat:read, chat:edit) are deprecated. We now use EventSub/Helix scopes for chat functionality.
Troubleshooting¶
If you get "redirect_uri does not match":
1. Make sure you're using exactly: http://localhost:3000
2. You may need to add this redirect URI in your Twitch app settings
If some events still fail with 403: - Some events require you to be a Partner or Affiliate (like channel points) - Some events need additional setup in your Twitch dashboard