feat(js): add clerk.oauthApplication.fetchConsentInfo#8275
feat(js): add clerk.oauthApplication.fetchConsentInfo#8275
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 8d6e852 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
as the FAPI client will set it automatically
dc2379d to
46c893c
Compare
📝 WalkthroughWalkthroughAdds OAuth consent support: new OAuthApplication resource with fetchConsentInfo(params) that GETs /me/oauth/consent/{oauthClientId} and returns normalized consent metadata (app name/logo/url, client id, state, scopes). Integrates the namespace into Clerk core and IsomorphicClerk getter, adds shared TypeScript types (oauthApplication.ts), re-exports the resource, adds Vitest tests covering success, error, and offline cases, and includes a changeset for a minor release. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/few-stamps-retire.md:
- Line 2: The changeset currently marks '@clerk/clerk-js' as a patch release but
this PR adds new public API (e.g., clerk.oauthApplication.fetchConsentInfo and
its public types), so update the changeset to use a minor bump instead of patch
by replacing the entry value 'patch' with 'minor' for the '@clerk/clerk-js'
package in the .changeset file so the release is versioned correctly.
In `@packages/clerk-js/src/core/resources/__tests__/OAuthApplication.test.ts`:
- Around line 30-63: The tests reference an outdated request contract for
OAuthApplication.fetchConsentInfo and should be updated: change the first test
that asserts BaseResource._fetch was not called to instead assert the current
behavior of OAuthApplication.fetchConsentInfo when BaseResource.clerk.session is
undefined (i.e., that BaseResource._fetch is invoked with the current request
shape rather than not being called); and update the second test's expected
BaseResource._fetch call (the expect on fetchSpy) to match the current
implementation of OAuthApplication.fetchConsentInfo (remove the explicit
sessionId assertion and adjust the call args to whatever the function now
sends—preserve method, encoded path, search/scope and { skipUpdateClient: true }
but do not assert sessionId if the implementation no longer includes it). Ensure
you reference OAuthApplication.fetchConsentInfo and BaseResource._fetch when
making the assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: bf7a26bb-fb9a-49c6-b5ac-05f2ea9f3b06
📒 Files selected for processing (9)
.changeset/few-stamps-retire.mdpackages/clerk-js/src/core/clerk.tspackages/clerk-js/src/core/resources/OAuthApplication.tspackages/clerk-js/src/core/resources/__tests__/OAuthApplication.test.tspackages/clerk-js/src/core/resources/internal.tspackages/react/src/isomorphicClerk.tspackages/shared/src/types/clerk.tspackages/shared/src/types/index.tspackages/shared/src/types/oauthApplication.ts
packages/clerk-js/src/core/resources/__tests__/OAuthApplication.test.ts
Outdated
Show resolved
Hide resolved
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Description
Part of USER-3968
This is the first step in packaging/componentizing our OAuth Consent component. We have a couple primary SDK functions we need: fetching consent info, and posting the user's consent choice.
Separate PRs will add the hooks and other necessary functions. I wanted to start with something small to make sure I am using a good pattern.
I also did a manual test of this function in a local project. I can share that if needed.
Considerations
Is
OAuthApplicationa good name for the Resource? Or should it be justOAuthas was also suggested?Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change