commit
a
diff --git a/src/app/owner/users/page.tsx b/src/app/owner/users/page.tsx
index 865d15f..f56fe72 100644
--- a/src/app/owner/users/page.tsx
+++ b/src/app/owner/users/page.tsx
@@ -47,7 +47,7 @@ const FALLBACK_AVATAR = "https://m.doughmination.gay/img/avatars/favicon.png";
const UserManager: React.FC = () => {
const client = useDoughminationClient();
- // Email is contact metadata only (sign-in is PocketID). A user may change
+ // Email is contact metadata only (sign-in is the SSO). A user may change
// their OWN address on their profile page; an admin/owner may change anyone
// else's. This panel only ever acts on other people, so the control is
// owner-only here.
diff --git a/src/app/providers.tsx b/src/app/providers.tsx
index a3b5bff..5f08923 100644
--- a/src/app/providers.tsx
+++ b/src/app/providers.tsx
@@ -15,7 +15,7 @@ import { TooltipProvider } from "@/components/ui/tooltip";
/**
* Reads the auth token from localStorage on every request, so a token that
- * arrives after a PocketID login (or is cleared on logout) is always current
+ * arrives after an SSO login (or is cleared on logout) is always current
* without rebuilding the client.
*/
function readToken(): string | null {
diff --git a/src/app/user/login/callback/page.tsx b/src/app/user/login/callback/page.tsx
index bcc6ae0..132b786 100644
--- a/src/app/user/login/callback/page.tsx
+++ b/src/app/user/login/callback/page.tsx
@@ -12,7 +12,7 @@ import { useRouter } from "next/navigation";
import * as s from "../../auth.css";
/**
- * PocketID login landing page.
+ * SSO login landing page.
*
* The API's OIDC callback mints a JWT and redirects here with the token in the
* URL fragment (`#token=…&from=…`) so it never touches a server log. We read it
diff --git a/src/app/user/login/page.tsx b/src/app/user/login/page.tsx
index f7823d2..80fc8c5 100644
--- a/src/app/user/login/page.tsx
+++ b/src/app/user/login/page.tsx
@@ -27,7 +27,7 @@ const Login: React.FC = () => {
const handleLogin = () => {
setRedirecting(true);
- // Full navigation (not fetch): the API 302s to PocketID, which sends the
+ // Full navigation (not fetch): the API 302s to the SSO, which sends the
// browser back to our callback page with a token in the URL fragment.
window.location.href = client.pocketIdLoginUrl(from);
};
diff --git a/src/components/HomePage.tsx b/src/components/HomePage.tsx
index bca3b68..53178aa 100644
--- a/src/components/HomePage.tsx
+++ b/src/components/HomePage.tsx
@@ -15,6 +15,7 @@ import {
useSystem,
useUserInfo,
useConnectionStatus,
+ useDoughminationClient,
type PluralMember,
} from "@doughmination/react-api";
import { Button } from "@/components/ui/button";
@@ -50,6 +51,7 @@ const MENTAL_STATE_CLASSES: Record<string, string> = {
export default function HomePage() {
const router = useRouter();
+ const client = useDoughminationClient();
// UI-only state; all server data now comes from the package hooks below.
const [menuOpen, setMenuOpen] = useState(false);
@@ -174,10 +176,29 @@ export default function HomePage() {
};
}, [token, isMock, userInfoQuery.data]);
- const handleLogout = () => {
+ const handleLogout = async () => {
+ const current = localStorage.getItem("token");
localStorage.removeItem("token");
setToken(null);
- router.push("/");
+
+ // End the API session and, via the SSO's logout page, the SSO session too.
+ // If the API can't be reached the local sign-out above still stands.
+ let endSession: string | null = null;
+ if (current) {
+ try {
+ const res = await fetch(`${client.baseUrl}/plural/auth/logout`, {
+ method: "POST",
+ headers: { Authorization: `Bearer ${current}` },
+ });
+ const data = (await res.json()) as { end_session_url?: string | null };
+ endSession = data.end_session_url ?? null;
+ } catch {
+ // offline or API down
+ }
+ }
+
+ if (endSession) window.location.href = endSession;
+ else router.push("/");
};
// Event handlers