From 6c4a67d3f74c82b4603c3586f51e16d427964780 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Fri, 24 Jul 2026 21:19:33 +0000 Subject: [PATCH] Route OIDC failures through shared auth error page A dedicated personal-account page does not scale as more refusal reasons appear. Redirect the OIDC callback to /auth/error with an error code query parameter so the frontend can map codes to clear user-facing messages. Signed-off-by: Cursor Agent Co-authored-by: Bryan FRIMIN --- ...ntNotAllowedPage.tsx => AuthErrorPage.tsx} | 41 +++++++++++++---- apps/console/src/routes.tsx | 6 +-- pkg/server/api/connect/v1/auth_error.go | 43 ++++++++++++++++++ pkg/server/api/connect/v1/auth_error_test.go | 45 +++++++++++++++++++ pkg/server/api/connect/v1/oidc_handler.go | 6 +-- 5 files changed, 126 insertions(+), 15 deletions(-) rename apps/console/src/pages/iam/auth/{PersonalAccountNotAllowedPage.tsx => AuthErrorPage.tsx} (59%) create mode 100644 pkg/server/api/connect/v1/auth_error.go create mode 100644 pkg/server/api/connect/v1/auth_error_test.go diff --git a/apps/console/src/pages/iam/auth/PersonalAccountNotAllowedPage.tsx b/apps/console/src/pages/iam/auth/AuthErrorPage.tsx similarity index 59% rename from apps/console/src/pages/iam/auth/PersonalAccountNotAllowedPage.tsx rename to apps/console/src/pages/iam/auth/AuthErrorPage.tsx index 2c399c34c..7636d6751 100644 --- a/apps/console/src/pages/iam/auth/PersonalAccountNotAllowedPage.tsx +++ b/apps/console/src/pages/iam/auth/AuthErrorPage.tsx @@ -21,21 +21,46 @@ import { usePageTitle } from "@probo/hooks"; import { useTranslate } from "@probo/i18n"; import { Button } from "@probo/ui"; +import { useSearchParams } from "react-router"; -export default function PersonalAccountNotAllowedPage() { +type AuthErrorContent = { + title: string; + description: string; +}; + +function useAuthErrorContent(code: string | null): AuthErrorContent { const { __ } = useTranslate(); - usePageTitle(__("Enterprise account required")); + switch (code) { + case "personal_account_not_allowed": + return { + title: __("Enterprise account required"), + description: __( + "Personal Google and Microsoft accounts cannot be used to sign in. Please use your work or school account instead.", + ), + }; + default: + return { + title: __("Authentication failed"), + description: __( + "We could not complete your sign-in. Please try again.", + ), + }; + } +} + +export default function AuthErrorPage() { + const { __ } = useTranslate(); + const [searchParams] = useSearchParams(); + const content = useAuthErrorContent(searchParams.get("error")); + + usePageTitle(content.title); return (
-

{__("Enterprise account required")}

-

- {__( - "Personal Google and Microsoft accounts cannot be used to sign in. Please use your work or school account instead.", - )} -

+

{content.title}

+

{content.description}