File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @clerk/clerk-js ' : patch
3+ ' @clerk/clerk-react ' : patch
4+ ' @clerk/types ' : patch
5+ ---
6+
7+ Introduce ` __internal_hasAfterAuthFlows ` flag
Original file line number Diff line number Diff line change @@ -2524,6 +2524,10 @@ export class Clerk implements ClerkInterface {
25242524 this . #emit( ) ;
25252525 } ;
25262526
2527+ get __internal_hasAfterAuthFlows ( ) {
2528+ return ! ! this . environment ?. organizationSettings ?. forceOrganizationSelection ;
2529+ }
2530+
25272531 #defaultSession = ( client : ClientResource ) : SignedInSessionResource | null => {
25282532 if ( client . lastActiveSessionId ) {
25292533 const currentSession = client . signedInSessions . find ( s => s . id === client . lastActiveSessionId ) ;
Original file line number Diff line number Diff line change @@ -235,11 +235,10 @@ export class SignIn extends BaseResource implements SignInResource {
235235
236236 const redirectUrlWithAuthToken = SignIn . clerk . buildUrlWithAuth ( redirectUrl ) ;
237237
238- // When force organization selection is enabled, redirect to SSO callback route.
238+ // When after-auth is enabled, redirect to SSO callback route.
239239 // This ensures organization selection tasks are displayed after sign-in,
240240 // rather than redirecting to potentially unprotected pages while the session is pending.
241- const actionCompleteRedirectUrl = SignIn . clerk . __unstable__environment ?. organizationSettings
242- . forceOrganizationSelection
241+ const actionCompleteRedirectUrl = SignIn . clerk . __internal_hasAfterAuthFlows
243242 ? redirectUrlWithAuthToken
244243 : redirectUrlComplete ;
245244
Original file line number Diff line number Diff line change @@ -290,11 +290,10 @@ export class SignUp extends BaseResource implements SignUpResource {
290290
291291 const redirectUrlWithAuthToken = SignUp . clerk . buildUrlWithAuth ( redirectUrl ) ;
292292
293- // When force organization selection is enabled, redirect to SSO callback route.
293+ // When force after-auth is enabled, redirect to SSO callback route.
294294 // This ensures organization selection tasks are displayed after sign-up,
295295 // rather than redirecting to potentially unprotected pages while the session is pending.
296- const actionCompleteRedirectUrl = SignUp . clerk . __unstable__environment ?. organizationSettings
297- . forceOrganizationSelection
296+ const actionCompleteRedirectUrl = SignUp . clerk . __internal_hasAfterAuthFlows
298297 ? redirectUrlWithAuthToken
299298 : redirectUrlComplete ;
300299
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ type IsomorphicLoadedClerk = Without<
105105 | 'apiKeys'
106106 | '__internal_setComponentNavigationContext'
107107 | '__internal_setActiveInProgress'
108+ | '__internal_hasAfterAuthFlows'
108109> & {
109110 client : ClientResource | undefined ;
110111 billing : CommerceBillingNamespace | undefined ;
Original file line number Diff line number Diff line change @@ -841,6 +841,12 @@ export interface Clerk {
841841 */
842842 __internal_setActiveInProgress : boolean ;
843843
844+ /**
845+ * Internal flag indicating whether after-auth flows are enabled based on instance settings.
846+ * @internal
847+ */
848+ __internal_hasAfterAuthFlows : boolean ;
849+
844850 /**
845851 * API Keys Object
846852 * @experimental
You can’t perform that action at this time.
0 commit comments