Files
Fitness/web/login.php
T

30 lines
934 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// login.php
require __DIR__ . '/vendor/autoload.php';
session_start();
$oidc = new \Jumbojett\OpenIDConnectClient(
'https://auth.matt-cloud.com/', // ***ISSUER***
'fitness-oidc',
'egebuqzZfVnjjBG9JDQ8tjW3TzV9gJurvT7qfB6c2SX2nPBNeaGycDfx4788QzJd'
);
// If you’re on a dev environment with a self‑signed cert:
# $oidc->setVerifyPeer(false); // <-- DO NOT USE IN PRODUCTION
// PKCE – optional but recommended for public clients
$oidc->setCodeChallengeMethod('S256');
// Tell the client where to land after Auth
$oidc->setRedirectURL('https://fitness.matt-cloud.com/pgapi/auth/oidc/callback');
// Optional: hard‑code the discovery URL
$oidc->setDiscoveryEndpoint('https://auth.matt-cloud.com/.well-known/openid-configuration');
try {
$oidc->authenticate(); // sends 302 → Authelia
} catch (Exception $e) {
http_response_code(500);
echo 'Login failed: ' . $e->getMessage();
exit;
}