Skip to content

feat(js): add clerk.oauthApplication.fetchConsentInfo#8275

Open
jfoshee wants to merge 5 commits intomainfrom
jfoshee/user-3968-add-oauth-app-fetch-consent-info
Open

feat(js): add clerk.oauthApplication.fetchConsentInfo#8275
jfoshee wants to merge 5 commits intomainfrom
jfoshee/user-3968-add-oauth-app-fetch-consent-info

Conversation

@jfoshee
Copy link
Copy Markdown
Contributor

@jfoshee jfoshee commented Apr 8, 2026

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 OAuthApplication a good name for the Resource? Or should it be just OAuth as was also suggested?

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 8, 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 Apr 8, 2026 11:06pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

🦋 Changeset detected

Latest commit: 8d6e852

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

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Minor
@clerk/chrome-extension Patch
@clerk/expo 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

@jfoshee jfoshee force-pushed the jfoshee/user-3968-add-oauth-app-fetch-consent-info branch from dc2379d to 46c893c Compare April 8, 2026 21:31
@jfoshee jfoshee marked this pull request as ready for review April 8, 2026 21:39
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

Adds 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)
Check name Status Explanation
Title check ✅ Passed The title 'feat(js): add clerk.oauthApplication.fetchConsentInfo' accurately summarizes the main change: adding a new OAuth application API method.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining the addition of OAuth consent functionality as part of a larger feature.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4c03816 and 46c893c.

📒 Files selected for processing (9)
  • .changeset/few-stamps-retire.md
  • packages/clerk-js/src/core/clerk.ts
  • packages/clerk-js/src/core/resources/OAuthApplication.ts
  • packages/clerk-js/src/core/resources/__tests__/OAuthApplication.test.ts
  • packages/clerk-js/src/core/resources/internal.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/shared/src/types/clerk.ts
  • packages/shared/src/types/index.ts
  • packages/shared/src/types/oauthApplication.ts

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 8, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@8275

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 8d6e852

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.

1 participant