OIDC test - test jumbojett oidc php app

This commit is contained in:
matt committed 2026-10-23 04:38:37 -07:00
1 parent a759eb206f
commit 97a31db020
6 files changed
+79 -98

No files matched your search

+14 -13
View File
@@ -1,18 +1,19 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/vendor/autoload.php';
// login.php
require __DIR__ . '/../vendor/autoload.php';
session_start();
use Fitness\OIDC\OIDC;
$oidc = new \Jumbojett\OpenIDConnectClient(
'https://auth.matt-cloud.com/oidc',
'fitness-oidc',
'egebuqzZfVnjjBG9JDQ8tjW3TzV9gJurvT7qfB6c2SX2nPBNeaGycDfx4788QzJd'
);
// Generate a cryptographically random state & nonce.
$state = bin2hex(random_bytes(16));
$nonce = bin2hex(random_bytes(16));
// Tell the client where the user should be redirected after Auth
$oidc->setRedirectURL('https://fitness.matt-cloud.com/pgapi/auth/oidc/callback');
// Persist them in the session to validate later.
$_SESSION['oidc_state'] = $state;
$_SESSION['oidc_nonce'] = $nonce;
// If you want PKCE (recommended for public clients)
$oidc->setCodeChallengeMethod('S256');
$oidc = new OIDC();
header('Location: ' . $oidc->buildAuthUrl($state, $nonce));
exit;
// Start the auth flow
$oidc->authenticate();