File tree Expand file tree Collapse file tree
packages/ui/src/components/OAuthConsent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ function _OAuthConsent() {
7272 const redirectUrl = ctx . redirectUrl ?? getRedirectUriFromSearch ( ) ;
7373
7474 const hasOrgReadScope = scopes . some ( s => s . scope === USER_ORG_READ_SCOPE ) ;
75- const orgSelectionEnabled = ! ! ( hasOrgReadScope && organizationSettings . enabled ) ;
75+ const orgSelectionEnabled = ! ! ( ( hasOrgReadScope || ctx . enableOrgSelection ) && organizationSettings . enabled ) ;
7676 const orgOptions = orgSelectionEnabled
7777 ? ( user ?. organizationMemberships ?? [ ] ) . map ( m => ( {
7878 value : m . organization . id ,
Original file line number Diff line number Diff line change @@ -390,6 +390,25 @@ describe('OAuthConsent', () => {
390390 } ) ;
391391 } ) ;
392392
393+ it ( 'renders the org selector when __internal_enableOrgSelection is true (fallback for existing apps)' , async ( ) => {
394+ const { wrapper, fixtures, props } = await createFixtures ( f => {
395+ f . withUser ( {
396+ email_addresses : [ 'jane@example.com' ] ,
397+ organization_memberships : [ { id : 'org_1' , name : 'Acme Corp' } ] ,
398+ } ) ;
399+ f . withOrganizations ( ) ;
400+ } ) ;
401+
402+ props . setProps ( { componentName : 'OAuthConsent' , __internal_enableOrgSelection : true } as any ) ;
403+ mockOAuthApplication ( fixtures . clerk , { getConsentInfo : vi . fn ( ) . mockResolvedValue ( fakeConsentInfo ) } ) ;
404+
405+ const { getByText } = render ( < OAuthConsent /> , { wrapper } ) ;
406+
407+ await waitFor ( ( ) => {
408+ expect ( getByText ( 'Acme Corp' ) ) . toBeVisible ( ) ;
409+ } ) ;
410+ } ) ;
411+
393412 it ( 'does not display user:org:read in the scopes list' , async ( ) => {
394413 const { wrapper, fixtures, props } = await createFixtures ( f => {
395414 f . withUser ( {
You can’t perform that action at this time.
0 commit comments