Skip to content

feat(ui): Show OAuthConsent org selector from user:org:read scope#8415

Merged
wobsoriano merged 10 commits intomainfrom
rob/user-5239-sdk-should-use-new-scope-for-displaying-org-selector
May 1, 2026
Merged

feat(ui): Show OAuthConsent org selector from user:org:read scope#8415
wobsoriano merged 10 commits intomainfrom
rob/user-5239-sdk-should-use-new-scope-for-displaying-org-selector

Conversation

@wobsoriano
Copy link
Copy Markdown
Member

@wobsoriano wobsoriano commented Apr 28, 2026

Description

The org selector previously relied on the __internal_enableOrgSelection flag. It now also activates when user:org:read (ref) is present in the granted scopes, which is the long-term path forward. The flag is kept as a fallback so existing callers aren't broken. The user:org:read scope is filtered from the visible scopes list, consistent with how offline_access is handled.

will remove __internal_enableOrgSelection in a follow up PR once we updated our dashboard consent page which the CLI app uses.

Resolves USER-5239

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 1, 2026 1:47am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 28, 2026

🦋 Changeset detected

Latest commit: c11d614

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Minor
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the ui label Apr 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

📝 Walkthrough

Walkthrough

This PR adds a changeset for a minor release and updates OAuthConsent so organization selection is gated by the resolved presence of the user:org:read scope (in addition to existing ctx.enableOrgSelection). The component recomputes org options/default/effective org after scope resolution and omits user:org:read (and offline_access) from the displayed scopes list; a hidden organization_id input is still emitted when appropriate. Tests are updated to assert org-selection behavior based on scope presence, with one test preserving the legacy internal flag path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enabling the OAuthConsent org selector based on the user:org:read scope.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly relates to the changeset, explaining how the org selector now activates based on user:org:read scope instead of relying solely on __internal_enableOrgSelection.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8415

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8415

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8415

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8415

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8415

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8415

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8415

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8415

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8415

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8415

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8415

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8415

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8415

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8415

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8415

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8415

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8415

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8415

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8415

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8415

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8415

commit: c11d614

@wobsoriano
Copy link
Copy Markdown
Member Author

!snapshot

@github-actions
Copy link
Copy Markdown
Contributor

Hey @wobsoriano - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 3.0.22-snapshot.v20260429150611
@clerk/backend 3.4.2-snapshot.v20260429150611
@clerk/chrome-extension 3.1.19-snapshot.v20260429150611
@clerk/clerk-js 6.7.8-snapshot.v20260429150611
@clerk/dev-cli 0.1.1-snapshot.v20260429150611
@clerk/expo 3.2.5-snapshot.v20260429150611
@clerk/expo-passkeys 1.0.18-snapshot.v20260429150611
@clerk/express 2.1.10-snapshot.v20260429150611
@clerk/fastify 3.1.20-snapshot.v20260429150611
@clerk/hono 0.1.20-snapshot.v20260429150611
@clerk/localizations 4.5.6-snapshot.v20260429150611
@clerk/msw 0.0.18-snapshot.v20260429150611
@clerk/nextjs 7.2.8-snapshot.v20260429150611
@clerk/nuxt 2.2.9-snapshot.v20260429150611
@clerk/react 6.4.6-snapshot.v20260429150611
@clerk/react-router 3.1.8-snapshot.v20260429150611
@clerk/shared 4.8.6-snapshot.v20260429150611
@clerk/tanstack-react-start 1.1.8-snapshot.v20260429150611
@clerk/testing 2.0.22-snapshot.v20260429150611
@clerk/ui 1.7.0-snapshot.v20260429150611
@clerk/upgrade 2.0.3-snapshot.v20260429150611
@clerk/vue 2.0.19-snapshot.v20260429150611

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@3.0.22-snapshot.v20260429150611 --save-exact

@clerk/backend

npm i @clerk/backend@3.4.2-snapshot.v20260429150611 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@3.1.19-snapshot.v20260429150611 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@6.7.8-snapshot.v20260429150611 --save-exact

@clerk/dev-cli

npm i @clerk/dev-cli@0.1.1-snapshot.v20260429150611 --save-exact

@clerk/expo

npm i @clerk/expo@3.2.5-snapshot.v20260429150611 --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@1.0.18-snapshot.v20260429150611 --save-exact

@clerk/express

npm i @clerk/express@2.1.10-snapshot.v20260429150611 --save-exact

@clerk/fastify

npm i @clerk/fastify@3.1.20-snapshot.v20260429150611 --save-exact

@clerk/hono

npm i @clerk/hono@0.1.20-snapshot.v20260429150611 --save-exact

@clerk/localizations

npm i @clerk/localizations@4.5.6-snapshot.v20260429150611 --save-exact

@clerk/msw

npm i @clerk/msw@0.0.18-snapshot.v20260429150611 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@7.2.8-snapshot.v20260429150611 --save-exact

@clerk/nuxt

npm i @clerk/nuxt@2.2.9-snapshot.v20260429150611 --save-exact

@clerk/react

npm i @clerk/react@6.4.6-snapshot.v20260429150611 --save-exact

@clerk/react-router

npm i @clerk/react-router@3.1.8-snapshot.v20260429150611 --save-exact

@clerk/shared

npm i @clerk/shared@4.8.6-snapshot.v20260429150611 --save-exact

@clerk/tanstack-react-start

npm i @clerk/tanstack-react-start@1.1.8-snapshot.v20260429150611 --save-exact

@clerk/testing

npm i @clerk/testing@2.0.22-snapshot.v20260429150611 --save-exact

@clerk/ui

npm i @clerk/ui@1.7.0-snapshot.v20260429150611 --save-exact

@clerk/upgrade

npm i @clerk/upgrade@2.0.3-snapshot.v20260429150611 --save-exact

@clerk/vue

npm i @clerk/vue@2.0.19-snapshot.v20260429150611 --save-exact

const redirectUrl = ctx.redirectUrl ?? getRedirectUriFromSearch();

const hasOrgReadScope = scopes.some(s => s.scope === USER_ORG_READ_SCOPE);
const orgSelectionEnabled = !!((hasOrgReadScope || ctx.enableOrgSelection) && organizationSettings.enabled);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new scope takes precedence over __internal_enableOrgSelection when present, so we can safely remove the flag in a follow-up PR once confirmed working.

@wobsoriano wobsoriano requested a review from jfoshee April 29, 2026 15:44
@wobsoriano wobsoriano merged commit 59400e3 into main May 1, 2026
43 checks passed
@wobsoriano wobsoriano deleted the rob/user-5239-sdk-should-use-new-scope-for-displaying-org-selector branch May 1, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants