From bbd3637351a2244e59abe3cf4cab49706a582ab7 Mon Sep 17 00:00:00 2001 From: JOY <5027251+JOY@users.noreply.github.com> Date: Tue, 22 Sep 2026 01:24:28 +0700 Subject: [PATCH 1/2] fix(auth): fall back to the manual form when the OIDC provider is unreachable The automatic OIDC redirect fired authClient.oidc.signIn() without a .catch, so an unreachable IdP left users on the redirect spinner forever with no error, no retry, and no path to the break-glass form. Catch the rejection and re-render the manual form (retry button, ?direct=1 break-glass door) instead. Also port the synchronous embedded-hash guard from the signin route to the signup route so embedded signing widgets cannot bounce to the IdP from a crafted /signup URL. --- .../app/routes/_unauthenticated+/signin.tsx | 9 +++++++-- .../app/routes/_unauthenticated+/signup.tsx | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/apps/remix/app/routes/_unauthenticated+/signin.tsx b/apps/remix/app/routes/_unauthenticated+/signin.tsx index 3b13832b4b..6f9b9bda09 100644 --- a/apps/remix/app/routes/_unauthenticated+/signin.tsx +++ b/apps/remix/app/routes/_unauthenticated+/signin.tsx @@ -95,6 +95,7 @@ export default function SignIn({ loaderData }: Route.ComponentProps) { const [searchParams] = useSearchParams(); const [isEmbeddedRedirect, setIsEmbeddedRedirect] = useState(false); + const [isRedirectFailed, setIsRedirectFailed] = useState(false); const errorParam = searchParams.get('error'); const signupError = errorParam ? SIGNUP_ERROR_MESSAGES[errorParam] : undefined; @@ -128,10 +129,14 @@ export default function SignIn({ loaderData }: Route.ComponentProps) { return; } - void authClient.oidc.signIn({ redirectPath: returnTo ?? '/' }); + authClient.oidc.signIn({ redirectPath: returnTo ?? '/' }).catch(() => { + // Fall back to the manual form (retry button, break-glass door) instead + // of leaving the user on the spinner forever when the IdP is unreachable. + setIsRedirectFailed(true); + }); }, [shouldRedirectToOIDC, returnTo]); - if (shouldRedirectToOIDC) { + if (shouldRedirectToOIDC && !isRedirectFailed) { return (