Skip to content

Consent dialog scope parameter#8048

Draft
jfoshee wants to merge 1 commit intomainfrom
cursor/consent-dialog-scope-parameter-db26
Draft

Consent dialog scope parameter#8048
jfoshee wants to merge 1 commit intomainfrom
cursor/consent-dialog-scope-parameter-db26

Conversation

@jfoshee
Copy link
Contributor

@jfoshee jfoshee commented Mar 11, 2026

Description

This PR enables the OAuthConsent component to dynamically fetch consent details from the FAPI endpoint /v1/me/oauth/consent/{client_id}. This is achieved by introducing clientId and scope as new props to the component. When clientId is provided, the component will use a new internal Clerk method (__internal_fetchOAuthConsent) to make a FAPI request, passing the scope as a query parameter.

This change supports USER-4924 by allowing the consent dialog to be populated directly from the backend based on the provided client and requested scopes. It maintains backward compatibility for existing prop-based usage when clientId is not provided. A loading state is also included while data is being fetched.

How to test:

  1. Run the sandbox app (pnpm dev:sandbox).
  2. Navigate to the OAuth consent page.
  3. Append ?client_id=<your_client_id>&scope=<space_delimited_scopes> to the URL (e.g., ?client_id=client_xxxx&scope=profile%20email) to observe the component fetching and displaying consent data.

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:
Open in Web Open in Cursor 

Add clientId and scope props to __internal_OAuthConsentProps so the
OAuthConsent component can fetch consent details from
/v1/me/oauth/consent/{client_id}?scope=<space-delimited-scopes>.

When clientId is provided, the component fetches consent data from the
FAPI endpoint. The scope prop is a space-delimited list of OAuth scopes
included as a query parameter on the request. Fetched data is merged
with any directly supplied props, maintaining backward compatibility.

Changes:
- packages/shared: Add clientId, scope to __internal_OAuthConsentProps;
  make data props optional (oAuthApplicationName, scopes, redirectUrl,
  onAllow, onDeny)
- packages/shared: Add __internal_fetchOAuthConsent to Clerk interface
- packages/clerk-js: Implement __internal_fetchOAuthConsent on Clerk
  class using the FAPI client
- packages/react: Wire __internal_fetchOAuthConsent through
  IsomorphicClerk
- packages/ui: OAuthConsent component fetches consent data when clientId
  is provided, with loading state
- packages/clerk-js/sandbox: Support client_id and scope URL params

Part of USER-4924
@cursor
Copy link

cursor bot commented Mar 11, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@changeset-bot
Copy link

changeset-bot bot commented Mar 11, 2026

⚠️ No Changeset found

Latest commit: f481d4e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Mar 11, 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 Mar 11, 2026 10:32pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants