[PR #7399] [CLOSED] Issue 7396 research #7284

Closed
opened 2026-03-13 13:30:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7399
Author: @Bekacru
Created: 1/15/2026
Status: Closed

Base: canaryHead: cursor/issue-7396-research-dab8


📝 Commits (10+)

  • bd843a6 docs: add comprehensive research for issue #7396 - server-side fetchOptions support
  • 3a6baba docs: add executive summary for issue #7396
  • 2023052 docs: add detailed implementation examples for issue #7396
  • 24392f9 docs: add edge cases and considerations for issue #7396
  • b948f39 docs: add comprehensive README tying together all research for issue #7396
  • c85af82 docs: add visual flow diagrams for issue #7396
  • ece7773 chore: remove research docs, proceeding with implementation
  • a9a1fd0 docs: add implementation plan for centralized fetch instance
  • 480e7da docs: update implementation plan to use getCurrentAuthContext for async storage access
  • 354c4e9 feat: add fetchOptions to BetterAuthOptions and create configured fetch instance in context

📊 Changes

21 files changed (+783 additions, -135 deletions)

View changed files

FILES_TO_MODIFY.md (+183 -0)
IMPLEMENTATION_PLAN.md (+368 -0)
📝 packages/better-auth/src/context/create-context.ts (+8 -0)
📝 packages/better-auth/src/plugins/captcha/index.ts (+29 -28)
📝 packages/better-auth/src/plugins/captcha/verify-handlers/captchafox.ts (+4 -2)
📝 packages/better-auth/src/plugins/captcha/verify-handlers/cloudflare-turnstile.ts (+4 -2)
📝 packages/better-auth/src/plugins/captcha/verify-handlers/google-recaptcha.ts (+4 -2)
📝 packages/better-auth/src/plugins/captcha/verify-handlers/h-captcha.ts (+4 -2)
📝 packages/better-auth/src/plugins/haveibeenpwned/index.ts (+2 -2)
📝 packages/core/src/oauth2/client-credentials-token.ts (+3 -2)
📝 packages/core/src/oauth2/refresh-access-token.ts (+3 -2)
📝 packages/core/src/oauth2/validate-authorization-code.ts (+5 -3)
📝 packages/core/src/oauth2/verify.ts (+19 -16)
📝 packages/core/src/social-providers/apple.ts (+3 -2)
📝 packages/core/src/social-providers/discord.ts (+13 -12)
📝 packages/core/src/social-providers/facebook.ts (+14 -13)
📝 packages/core/src/social-providers/github.ts (+28 -27)
📝 packages/core/src/social-providers/spotify.ts (+7 -6)
📝 packages/core/src/social-providers/twitter.ts (+11 -10)
📝 packages/core/src/types/context.ts (+21 -4)

...and 1 more files

📄 Description

Created comprehensive research documents for issue #7396.

This PR provides a detailed analysis and implementation plan for adding server-side fetchOptions support to Better Auth, enabling corporate proxy compatibility and custom fetch implementations for OAuth requests.


Slack Thread

Open in Cursor Open in Web


Summary by cubic

Adds server-side fetchOptions support by creating a centralized fetch instance in Better Auth’s context, enabling corporate proxies and custom OAuth/captcha/provider requests. Removes prior research docs and adds an implementation plan and file audit; aligns with issue #7396.

  • New Features
    • Added fetchOptions to BetterAuthOptions.
    • Created ctx.fetch via createFetch, configurable with custom fetch/dispatcher/agent, and exposed on AuthContext.
    • Updated OAuth2 core, captcha handlers, HaveIBeenPwned, and initial social providers (GitHub, Discord, Apple, Facebook, Spotify, Twitter) to use the configured fetch via the current auth context.

Written for commit 38f05f0522. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7399 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 1/15/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `cursor/issue-7396-research-dab8` --- ### 📝 Commits (10+) - [`bd843a6`](https://github.com/better-auth/better-auth/commit/bd843a699a9ccb5bff3ee8805c7af5da167e86b1) docs: add comprehensive research for issue #7396 - server-side fetchOptions support - [`3a6baba`](https://github.com/better-auth/better-auth/commit/3a6babaa94e02ff808e8aae9a1f43ade930e6bf4) docs: add executive summary for issue #7396 - [`2023052`](https://github.com/better-auth/better-auth/commit/2023052560e3b4178db00a8fa7126a1bda451840) docs: add detailed implementation examples for issue #7396 - [`24392f9`](https://github.com/better-auth/better-auth/commit/24392f9cadbfc05df1b79622f738843cbcfdb546) docs: add edge cases and considerations for issue #7396 - [`b948f39`](https://github.com/better-auth/better-auth/commit/b948f3984332dc707feef90ac6ef2f87e2ffc613) docs: add comprehensive README tying together all research for issue #7396 - [`c85af82`](https://github.com/better-auth/better-auth/commit/c85af825de4096cb4e2ca0f5f51b43dc8dbe0ac5) docs: add visual flow diagrams for issue #7396 - [`ece7773`](https://github.com/better-auth/better-auth/commit/ece777359ee4f0d163d4c4f0758b06b070a11ebe) chore: remove research docs, proceeding with implementation - [`a9a1fd0`](https://github.com/better-auth/better-auth/commit/a9a1fd01792cca96ac9b707682222a713e0b404c) docs: add implementation plan for centralized fetch instance - [`480e7da`](https://github.com/better-auth/better-auth/commit/480e7da4f05361fc0fc98b336ff5c2fbccee1788) docs: update implementation plan to use getCurrentAuthContext for async storage access - [`354c4e9`](https://github.com/better-auth/better-auth/commit/354c4e9055cd6efdc0bd151dd719b66f8d19e26d) feat: add fetchOptions to BetterAuthOptions and create configured fetch instance in context ### 📊 Changes **21 files changed** (+783 additions, -135 deletions) <details> <summary>View changed files</summary> ➕ `FILES_TO_MODIFY.md` (+183 -0) ➕ `IMPLEMENTATION_PLAN.md` (+368 -0) 📝 `packages/better-auth/src/context/create-context.ts` (+8 -0) 📝 `packages/better-auth/src/plugins/captcha/index.ts` (+29 -28) 📝 `packages/better-auth/src/plugins/captcha/verify-handlers/captchafox.ts` (+4 -2) 📝 `packages/better-auth/src/plugins/captcha/verify-handlers/cloudflare-turnstile.ts` (+4 -2) 📝 `packages/better-auth/src/plugins/captcha/verify-handlers/google-recaptcha.ts` (+4 -2) 📝 `packages/better-auth/src/plugins/captcha/verify-handlers/h-captcha.ts` (+4 -2) 📝 `packages/better-auth/src/plugins/haveibeenpwned/index.ts` (+2 -2) 📝 `packages/core/src/oauth2/client-credentials-token.ts` (+3 -2) 📝 `packages/core/src/oauth2/refresh-access-token.ts` (+3 -2) 📝 `packages/core/src/oauth2/validate-authorization-code.ts` (+5 -3) 📝 `packages/core/src/oauth2/verify.ts` (+19 -16) 📝 `packages/core/src/social-providers/apple.ts` (+3 -2) 📝 `packages/core/src/social-providers/discord.ts` (+13 -12) 📝 `packages/core/src/social-providers/facebook.ts` (+14 -13) 📝 `packages/core/src/social-providers/github.ts` (+28 -27) 📝 `packages/core/src/social-providers/spotify.ts` (+7 -6) 📝 `packages/core/src/social-providers/twitter.ts` (+11 -10) 📝 `packages/core/src/types/context.ts` (+21 -4) _...and 1 more files_ </details> ### 📄 Description Created comprehensive research documents for issue #7396. This PR provides a detailed analysis and implementation plan for adding server-side `fetchOptions` support to Better Auth, enabling corporate proxy compatibility and custom fetch implementations for OAuth requests. --- [Slack Thread](https://betterauth.slack.com/archives/C0A8B5BARUK/p1768499840464919?thread_ts=1768499840.464919&cid=C0A8B5BARUK) <a href="https://cursor.com/background-agent?bcId=bc-b54a7c39-c729-4799-9828-3066a666a3c4"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-b54a7c39-c729-4799-9828-3066a666a3c4"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds server-side fetchOptions support by creating a centralized fetch instance in Better Auth’s context, enabling corporate proxies and custom OAuth/captcha/provider requests. Removes prior research docs and adds an implementation plan and file audit; aligns with issue #7396. - **New Features** - Added fetchOptions to BetterAuthOptions. - Created ctx.fetch via createFetch, configurable with custom fetch/dispatcher/agent, and exposed on AuthContext. - Updated OAuth2 core, captcha handlers, HaveIBeenPwned, and initial social providers (GitHub, Discord, Apple, Facebook, Spotify, Twitter) to use the configured fetch via the current auth context. <sup>Written for commit 38f05f052232dcd9cfb23464267f28d2a55ec3ca. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:30:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7284