28 lines
874 B
PHP
28 lines
874 B
PHP
<?php
|
||
// logout.php
|
||
require __DIR__ . '/../vendor/autoload.php';
|
||
session_start();
|
||
|
||
$oidc = new \Jumbojett\OpenIDConnectClient(
|
||
'https://auth.matt-cloud.com/oidc',
|
||
'fitness-oidc',
|
||
'egebuqzZfVnjjBG9JDQ8tjW3TzV9gJurvT7qfB6c2SX2nPBNeaGycDfx4788QzJd'
|
||
);
|
||
|
||
// Build the end‑session endpoint (back‑channel logout)
|
||
$logoutUrl = $oidc->getLogoutEndpoint(); // e.g. https://auth.matt-cloud.com/logout
|
||
|
||
// Include the post‑logout redirect URI
|
||
$logoutUrl .= '?post_logout_redirect_uri=' . urlencode('https://fitness.matt-cloud.com/');
|
||
|
||
// Optionally pass the ID‑token hint so the OP can immediately terminate the session
|
||
if (isset($_SESSION['user']['id_token'])) {
|
||
$logoutUrl .= '&id_token_hint=' . urlencode($_SESSION['user']['id_token']);
|
||
}
|
||
|
||
// Destroy the local session first
|
||
session_destroy();
|
||
|
||
// Redirect the browser
|
||
header('Location: ' . $logoutUrl);
|
||
exit; |