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;