Fix Twitch OAuth redirect URI and update setup instructions

This commit is contained in:
Jo Eskil
2025-11-14 00:23:03 +01:00
parent b1b7759e13
commit 562e7792e9
3 changed files with 44 additions and 1 deletions

19
php/auth/twitch/login.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
// php/auth/twitch/login.php - Initiates Twitch OAuth flow
require_once '../../config.php';
// Scopes required to get user's email and channel info
$scopes = "user:read:email chat:read"; // Ensure chat:read is included
$auth_url = (
"https://id.twitch.tv/oauth2/authorize" .
"?client_id=" . TWITCH_CLIENT_ID .
"&redirect_uri=" . TWITCH_REDIRECT_URI .
"&response_type=code" .
"&scope=" . urlencode($scopes)
);
header("Location: " . $auth_url);
exit();
?>

24
php/config.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
// php/config.php
// Database credentials
define('DB_HOST', 'localhost');
define('DB_USER', 'multichat_user'); // Replace with your MySQL username
define('DB_PASS', '!Bdsbkh2!'); // Replace with your MySQL password
define('DB_NAME', 'multichat_overlay');
// Twitch API credentials
define('TWITCH_CLIENT_ID', 'hf00cu69zzjxbmtmjipzebrmsexuxt'); // Replace with your Twitch Client ID
define('TWITCH_CLIENT_SECRET', '9iqweehbkx113hqmrhigk3rsaoiyqa'); // Replace with your Twitch Client Secret
define('TWITCH_REDIRECT_URI', 'http://localhost/auth.php'); // Replace with your redirect URI
// Session secret for secure cookies
define('SESSION_SECRET', 'o2LuCTQHN1JMlR0HeciJTNTx9OMFg5zXBiEpes26ouo='); // IMPORTANT: Change this to a strong, random string
// WebSocket server address
define('WEBSOCKET_HOST', 'localhost');
define('WEBSOCKET_PORT', 8080);
// Base URL for the application
define('BASE_URL', 'http://localhost'); // Replace with your application's base URL
?>