Skip to content

fix(auth): handle automated MCP account linking and refresh token issuance - #728

Merged
codercatdev merged 1 commit into
devfrom
feat/mcp-account-linking
Oct 13, 2026
Merged

codercatdev merged 1 commit into
devfrom
feat/mcp-account-linking

Conversation

@codercatdev

Copy link
Copy Markdown
Contributor

Summary

Fixes Google Gemini custom app account linking error: Account linking is required to use this custom app. Try again.

Key Changes

  • Automated OAuth 2.0 Account Linking Handshake: In /oauth2/authorize, when confidential clients (like Google Gemini) request authorization with valid registered redirect URIs, generate an authorization code linked to the default explorer MCP session and redirect with 302 Location: {redirect_uri}?code=...&state=....
  • Refresh Token Issuance: In /oauth2/token, automatically append refresh_token in the JSON response when exchanging the code, saving the token to oauthRefreshToken table in Cloudflare D1. This satisfies Google Gemini's strict account linking requirement.
  • PKCE & Consent Compatibility: Applied migration 0002_default_mcp_account.sql ensuring default session and client flags requirePKCE = 0 and skipConsent = 1 for non-PKCE server-to-server OAuth clients. Added fallback /sign-in and /oauth2/consent Astro pages.
  • E2E Test Coverage: Added tests 7.13 and 7.14 in tier1-features.test.mjs verifying automated authorization redirection and refresh token issuance. All 160 E2E tests pass.

@github-actions

Copy link
Copy Markdown

⚡ Cloudflare Worker Preview Ready!

Environment URL
PR Preview https://10b80b0a-codingcatdev-dev.codingcatdev.workers.dev
Dev Custom Domain https://dev.codingcat.dev
  • Worker Version ID: 10b80b0a-0a12-4b4f-9304-bd28e4908488
  • Protection: Restricted to @codingcat.dev accounts via Cloudflare Zero Trust Access

@codercatdev
codercatdev merged commit 609c2f8 into dev Oct 13, 2026
2 checks passed
@codercatdev
codercatdev deleted the feat/mcp-account-linking branch October 13, 2026 20:21
codercatdev added a commit that referenced this pull request Oct 13, 2026
…en issuance to main (#729)

* feat(syndication): add syndicate-post workflow and dispatch runner (#708)

* fix(syndication): update Hashnode tag shape to PublishPostTagInput (#710)

* fix(syndication): update Hashnode coverImage input to string URL (#713)

* feat(seo): add VideoObject structured data and Gemini video storyboard pipeline (#715)

* fix(video): upgrade to Gemini 2.5 Pro with native Google AI and OpenRouter support (#717)

* feat: complete Shorts story (/shorts shelf + kinetic captions + sync), Gemini 2.5/TTS upgrades, and TechArticle/Auto-FAQ AEO pack (#720)

* chore: remove legacy apps/web Next.js directory and revert Gemini/Shorts pipeline additions (keep SEO schema) (#722)

* feat(analytics): add Cloudflare Workers Analytics Engine edge telemetry, sendBeacon click tracking, and first-party PostHog /ingest proxy (#724)

* feat(site): wire sponsorships and guest booking to FlipFeeds Creator OS dev/prod APIs

* fix(ci): deploy latest Worker version before updating secrets in deploy-workers.yml

* fix(site): defer analytics_engine_datasets binding until Analytics Engine is enabled on account

* feat(auth): integrate Better Auth with Cloudflare D1 for MCP and OAuth 2.1 Dynamic Client Registration (#726)

* fix(auth): handle automated MCP account linking and refresh token issuance (#728)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant