Files
Fitness/web/login.php
T
2026-10-23 03:25:41 -07:00

18 lines
472 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/vendor/autoload.php';
use Fitness\OIDC\OIDC;
// Generate a cryptographically random state & nonce.
$state = bin2hex(random_bytes(16));
$nonce = bin2hex(random_bytes(16));
// Persist them in the session to validate later.
$_SESSION['oidc_state'] = $state;
$_SESSION['oidc_nonce'] = $nonce;
$oidc = new OIDC();
header('Location: ' . $oidc->buildAuthUrl($state, $nonce));
exit;