Draft
Conversation
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 Agent can help with this pull request. Just |
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR enables the
OAuthConsentcomponent to dynamically fetch consent details from the FAPI endpoint/v1/me/oauth/consent/{client_id}. This is achieved by introducingclientIdandscopeas new props to the component. WhenclientIdis provided, the component will use a new internal Clerk method (__internal_fetchOAuthConsent) to make a FAPI request, passing thescopeas 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
clientIdis not provided. A loading state is also included while data is being fetched.How to test:
pnpm dev:sandbox).?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 testruns as expected.pnpm buildruns as expected.Type of change