[GH-ISSUE #972] Generic OAuth overrides other social providers #8528

Closed
opened 2026-04-13 03:37:46 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @kzlar on GitHub (Dec 21, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/972

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Configure better-auth with both generic-oauth plugin AND a social provider (eg google), eg:

...
 socialProviders: {
    google: {
      clientId: googleClientId,
      clientSecret: googleClientSecret,
    }
  },
  plugins: [
   genericOAuth({ 
            config: [ 
                { 
                    providerId: "provider-id", 
                    clientId: "test-client-id", 
                    clientSecret: "test-client-secret", 
                    discoveryUrl: "https://auth.example.com/.well-known/openid-configuration", 
                    // ... other config options
                }, 
            ] 
        }) 
  ],
...

Current vs. Expected behavior

Trying to sign in with social will result in "Provider not found" error. I expect it to work

What version of Better Auth are you using?

1.0.22

Provide environment information

MacOS, Chrome

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

No response

Additional context

I'm not 100% sure but it seems like the generic-oauth implementation completely overrides the socialProviders field of the config. Perhaps defu was supposed to merge the two but it doesn't seem like that's happeneing
https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/plugins/generic-oauth/index.ts#L175

Originally created by @kzlar on GitHub (Dec 21, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/972 ### Is this suited for github? - [X] Yes, this is suited for github ### To Reproduce Configure better-auth with both generic-oauth plugin AND a social provider (eg google), eg: ``` ... socialProviders: { google: { clientId: googleClientId, clientSecret: googleClientSecret, } }, plugins: [ genericOAuth({ config: [ { providerId: "provider-id", clientId: "test-client-id", clientSecret: "test-client-secret", discoveryUrl: "https://auth.example.com/.well-known/openid-configuration", // ... other config options }, ] }) ], ... ``` ### Current vs. Expected behavior Trying to sign in with social will result in "Provider not found" error. I expect it to work ### What version of Better Auth are you using? 1.0.22 ### Provide environment information ```bash MacOS, Chrome ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) _No response_ ### Additional context I'm not 100% sure but it seems like the generic-oauth implementation completely overrides the socialProviders field of the config. Perhaps `defu` was supposed to merge the two but it doesn't seem like that's happeneing https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/plugins/generic-oauth/index.ts#L175
GiteaMirror added the lockedbug labels 2026-04-13 03:37:46 -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#8528