[PR #4825] [MERGED] fix (oauth-proxy): use of productionURL in for callback comparison #22499

Closed
opened 2026-04-15 21:05:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4825
Author: @dvanmali
Created: 9/22/2025
Status: Merged
Merged: 9/23/2025
Merged by: @dvanmali

Base: canaryHead: oauthProxy


📝 Commits (2)

  • 271e386 fix: oauthProxy uses proper location origin comparison
  • 6c6b6c5 revert: only neccessary change

📊 Changes

2 files changed (+79 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/plugins/oauth-proxy/index.ts (+6 -1)
📝 packages/better-auth/src/plugins/oauth-proxy/oauth-proxy.test.ts (+73 -0)

📄 Description

Correctly determines the production url for the callback comparison.

Adds test outlined in #4815 to location callback baseUrl outlined.

Fixes: #4815
Replaces: #4819


Summary by cubic

Fixes the OAuth proxy callback origin check to use the configured productionURL (fallback to baseURL). Prevents wrong redirects and ensures callbacks return to the original app URL when expected.

  • Bug Fixes
    • Compare origin against productionURL || options.baseURL || baseURL for accurate same-origin detection.
    • Add test to verify proxying back to the original request URL when productionURL differs from baseURL.

🔄 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/4825 **Author:** [@dvanmali](https://github.com/dvanmali) **Created:** 9/22/2025 **Status:** ✅ Merged **Merged:** 9/23/2025 **Merged by:** [@dvanmali](https://github.com/dvanmali) **Base:** `canary` ← **Head:** `oauthProxy` --- ### 📝 Commits (2) - [`271e386`](https://github.com/better-auth/better-auth/commit/271e38638e45479dd58980b2d34dc8c7b0945e30) fix: oauthProxy uses proper location origin comparison - [`6c6b6c5`](https://github.com/better-auth/better-auth/commit/6c6b6c5ec0f4ac7a9f1be46020b383e00a0babc2) revert: only neccessary change ### 📊 Changes **2 files changed** (+79 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/oauth-proxy/index.ts` (+6 -1) 📝 `packages/better-auth/src/plugins/oauth-proxy/oauth-proxy.test.ts` (+73 -0) </details> ### 📄 Description Correctly determines the production url for the callback comparison. Adds test outlined in #4815 to location callback baseUrl outlined. Fixes: #4815 Replaces: #4819 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes the OAuth proxy callback origin check to use the configured productionURL (fallback to baseURL). Prevents wrong redirects and ensures callbacks return to the original app URL when expected. - **Bug Fixes** - Compare origin against productionURL || options.baseURL || baseURL for accurate same-origin detection. - Add test to verify proxying back to the original request URL when productionURL differs from baseURL. <!-- 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-04-15 21:05:24 -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#22499