fix(js): Send oidcPrompt and oidcLoginHint in external account requests - #9354
fix(js): Send oidcPrompt and oidcLoginHint in external account requests#9354wobsoriano wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 578b164 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@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: |
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
|
@wobsoriano What we observed: We call ExternalAccount.reauthorize({ additionalScopes: ['https://www.googleapis.com/auth/calendar.readonly'], oidcPrompt: 'consent', redirectUrl: ... }). This type-checks and our unit tests assert the param is passed. Why this hurts more than it looks: Because prompt=consent never reaches Google, the consent screen is skipped on reauthorization, so Google never issues a new refresh token covering the incrementally added scope (refresh tokens are only issued on consent, and their scopes are fixed at issuance). Clerk then keeps refreshing with the original sign-in refresh token (base scopes only). The result: the access token works right after reauthorization, but ~1 hour later (access token expiry) the Backend API token endpoint returns a token whose actual grant lacks the added scope — while the reported scopes metadata still lists it — and Google returns 403 insufficientPermissions. Users are forced to "reconnect" every hour, and the reconnect can never fix itself. This effectively makes incremental OAuth scopes unusable on web until this PR lands. Would love to see it merged — happy to test a canary. Thanks! |
Description
The public types for
user.createExternalAccount()andexternalAccount.reauthorize()have acceptedoidcPromptandoidcLoginHintsince they were added in #4789, but the ClerkJS resource implementations never read them, so both parameters were silently dropped from the Frontend API request. FAPI supportsoidc_promptandoidc_login_hinton bothPOST /v1/me/external_accountsandPATCH /v1/me/external_accounts/{id}/reauthorize.This meant
oidcPrompt: 'consent'never reached the OAuth authorization request. For Google connections needing offline access, an existing grant could be reused and return an access token without a refresh token, causinggetUserOauthAccessTokento later fail withoauth_missing_refresh_token.Fixes #9177
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change