[PR #1970] [CLOSED] Support genericOAuth for oAuthProxy #4096

Closed
opened 2026-03-13 11:32:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1970
Author: @ericclemmons
Created: 3/24/2025
Status: Closed

Base: mainHead: patch-1


📝 Commits (1)

  • 0c108d1 Support genericOAuth for oAuthProxy

📊 Changes

1 file changed (+8 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/plugins/oauth-proxy/index.ts (+8 -2)

📄 Description

I was able to develop & test this locally using this patch:

diff --git a/dist/plugins/oauth-proxy/index.mjs b/dist/plugins/oauth-proxy/index.mjs
index 3f76e7d8e961302fe9630b520191ad98e88b26c5..4f94bd1f99733e16319b56bd52824762e3606704 100644
--- a/dist/plugins/oauth-proxy/index.mjs
+++ b/dist/plugins/oauth-proxy/index.mjs
@@ -108,7 +108,10 @@ const oAuthProxy = (opts) => {
       after: [
         {
           matcher(context) {
-            return context.path?.startsWith("/callback");
+            return (
+              context.path?.startsWith("/callback") ||
+              context.path?.startsWith("/oauth2/callback")
+            );
           },
           handler: createAuthMiddleware(async (ctx) => {
             const headers = ctx.context.responseHeaders;
@@ -146,7 +149,10 @@ const oAuthProxy = (opts) => {
       before: [
         {
           matcher(context) {
-            return context.path?.startsWith("/sign-in/social");
+            return (
+              context.path?.startsWith("/sign-in/social") ||
+              context.path?.startsWith("/sign-in/oauth2")
+            );
           },
           handler: createAuthMiddleware(async (ctx) => {
             const url = new URL(

I used a Cloudflare Tunnel as my public URL to confirm this worked end-to-end.

I can help write tests for this if it's agreeable to you.

TODOS

  • Support genericOAuth
  • Fix GitHub's lousy spacing
  • Add tests

🔄 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/1970 **Author:** [@ericclemmons](https://github.com/ericclemmons) **Created:** 3/24/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`0c108d1`](https://github.com/better-auth/better-auth/commit/0c108d19975d454aafbdda32724f46fceca99bf1) Support genericOAuth for oAuthProxy ### 📊 Changes **1 file changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/oauth-proxy/index.ts` (+8 -2) </details> ### 📄 Description I was able to develop & test this locally using this patch: ```diff diff --git a/dist/plugins/oauth-proxy/index.mjs b/dist/plugins/oauth-proxy/index.mjs index 3f76e7d8e961302fe9630b520191ad98e88b26c5..4f94bd1f99733e16319b56bd52824762e3606704 100644 --- a/dist/plugins/oauth-proxy/index.mjs +++ b/dist/plugins/oauth-proxy/index.mjs @@ -108,7 +108,10 @@ const oAuthProxy = (opts) => { after: [ { matcher(context) { - return context.path?.startsWith("/callback"); + return ( + context.path?.startsWith("/callback") || + context.path?.startsWith("/oauth2/callback") + ); }, handler: createAuthMiddleware(async (ctx) => { const headers = ctx.context.responseHeaders; @@ -146,7 +149,10 @@ const oAuthProxy = (opts) => { before: [ { matcher(context) { - return context.path?.startsWith("/sign-in/social"); + return ( + context.path?.startsWith("/sign-in/social") || + context.path?.startsWith("/sign-in/oauth2") + ); }, handler: createAuthMiddleware(async (ctx) => { const url = new URL( ``` I used a Cloudflare Tunnel as my public URL to confirm this worked end-to-end. I can help write tests for this if it's agreeable to you. ### TODOS - [x] Support `genericOAuth` - [ ] Fix GitHub's lousy spacing - [ ] Add tests --- <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 11:32:31 -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#4096