From 7c3698d69406f822770f3abd73aa6c1eaf7aeba7 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Wed, 15 Apr 2026 19:00:10 -0400 Subject: [PATCH 1/2] fix(ui): OAuthConsent AuthenticatedRoutes usage --- .../components/OAuthConsent/OAuthConsent.tsx | 65 +++++++++++-------- .../__tests__/OAuthConsent.test.tsx | 4 +- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx b/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx index 430d8779103..6802e665807 100644 --- a/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx +++ b/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx @@ -10,6 +10,7 @@ import { Header } from '@/ui/elements/Header'; import { LoadingCardContainer } from '@/ui/elements/LoadingCard'; import { Modal } from '@/ui/elements/Modal'; import { Alert, Textarea } from '@/ui/primitives'; +import { Route, Switch } from '@/ui/router'; import { InlineAction } from './InlineAction'; import { @@ -94,41 +95,35 @@ function _OAuthConsent() { if (errorMessage) { return ( - - - - {errorMessage} - - - - + + + {errorMessage} + + + ); } if (isLoading) { return ( - - - - - - - - - ); - } - } - - if (ctx.enableOrgSelection && (!isMembershipsLoaded || userMemberships.isLoading)) { - return ( - - + ); + } + } + + if (ctx.enableOrgSelection && (!isMembershipsLoaded || userMemberships.isLoading)) { + return ( + + + + + + ); } @@ -155,7 +150,7 @@ function _OAuthConsent() { const hasOfflineAccess = scopes.some(item => item.scope === OFFLINE_ACCESS_SCOPE); return ( - + <>
- + ); } @@ -373,4 +368,20 @@ function RedirectUriModal({ onOpen, onClose, isOpen, redirectUri, oauthApplicati ); } -export const OAuthConsent = withCoreUserGuard(withCardStateProvider(_OAuthConsent)); +const AuthenticatedRoutes = withCoreUserGuard(withCardStateProvider(_OAuthConsent)); + +const OAuthConsentInternal = () => { + return ( + + + + + + + + + + ); +}; + +export const OAuthConsent = OAuthConsentInternal; diff --git a/packages/ui/src/components/OAuthConsent/__tests__/OAuthConsent.test.tsx b/packages/ui/src/components/OAuthConsent/__tests__/OAuthConsent.test.tsx index 911ef36327f..643e74d1a1d 100644 --- a/packages/ui/src/components/OAuthConsent/__tests__/OAuthConsent.test.tsx +++ b/packages/ui/src/components/OAuthConsent/__tests__/OAuthConsent.test.tsx @@ -181,9 +181,9 @@ describe('OAuthConsent', () => { const getConsentInfo = vi.fn().mockResolvedValue(fakeConsentInfo); mockOAuthApplication(fixtures.clerk, { getConsentInfo }); - const { container } = render(, { wrapper }); + const { queryByText } = render(, { wrapper }); - expect(container.firstChild).toBeNull(); + expect(queryByText('Clerk CLI')).toBeNull(); expect(getConsentInfo).not.toHaveBeenCalled(); }); From d64c25cac279a2e1c79ddb4b34233a4ee814b642 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Wed, 15 Apr 2026 19:01:06 -0400 Subject: [PATCH 2/2] add changeset --- .changeset/fix-oauth-consent-redirect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-oauth-consent-redirect.md diff --git a/.changeset/fix-oauth-consent-redirect.md b/.changeset/fix-oauth-consent-redirect.md new file mode 100644 index 00000000000..d1b82f62373 --- /dev/null +++ b/.changeset/fix-oauth-consent-redirect.md @@ -0,0 +1,5 @@ +--- +'@clerk/ui': patch +--- + +Fix OAuthConsent always redirecting to sign-in by adopting the `AuthenticatedRoutes` pattern used by other full-page components