Load config.local.php from repo root for server-side secrets
Provides a gitignored override file for credentials like LinkedIn OAuth keys, avoiding reliance on Apache SetEnv / PHP-FPM env config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e1f7fb14fc
commit
ac5b82c381
4 changed files with 8 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ $stmt = $db->prepare('SELECT * FROM projects WHERE id = ? AND is_active = 1');
|
|||
$stmt->execute([$pid]);
|
||||
if (!$stmt->fetch()) { http_response_code(404); echo json_encode(['error' => 'Project not found']); exit; }
|
||||
|
||||
$client_id = getenv('LINKEDIN_CLIENT_ID') ?: ($_SERVER['LINKEDIN_CLIENT_ID'] ?? null);
|
||||
$client_id = defined('LINKEDIN_CLIENT_ID') ? LINKEDIN_CLIENT_ID : (getenv('LINKEDIN_CLIENT_ID') ?: ($_SERVER['LINKEDIN_CLIENT_ID'] ?? null));
|
||||
if (!$client_id) { echo json_encode(['error' => 'LINKEDIN_CLIENT_ID not set in server environment']); exit; }
|
||||
|
||||
$state = bin2hex(random_bytes(16));
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ if (isset($_GET['error'])) {
|
|||
$code = $_GET['code'] ?? '';
|
||||
if (!$code) { echo 'Missing code. <a href="/">Go back</a>'; exit; }
|
||||
|
||||
$client_id = getenv('LINKEDIN_CLIENT_ID') ?: ($_SERVER['LINKEDIN_CLIENT_ID'] ?? null);
|
||||
$client_secret = getenv('LINKEDIN_CLIENT_SECRET') ?: ($_SERVER['LINKEDIN_CLIENT_SECRET'] ?? null);
|
||||
$client_id = defined('LINKEDIN_CLIENT_ID') ? LINKEDIN_CLIENT_ID : (getenv('LINKEDIN_CLIENT_ID') ?: ($_SERVER['LINKEDIN_CLIENT_ID'] ?? null));
|
||||
$client_secret = defined('LINKEDIN_CLIENT_SECRET') ? LINKEDIN_CLIENT_SECRET : (getenv('LINKEDIN_CLIENT_SECRET') ?: ($_SERVER['LINKEDIN_CLIENT_SECRET'] ?? null));
|
||||
$redirect_uri = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/linkedin/callback';
|
||||
|
||||
// Exchange code for tokens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue