Allow custom OAuth provider IDs in trusted providers #236

Closed
opened 2026-03-13 07:39:10 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @awesomepandapig on GitHub (Nov 16, 2024).

I am trying to use the Generic OAuth plugin to provide one-click SSO for my application. Currently, however, I am unable to complete the flow. I can successfully authorize the application and this is what is logged by my SSO provider.

Screenshot 2024-11-16 113808

Once it authorizes and connects to the callback, it does not sign me in and instead gives me the following error:

image

I assume this is due to the the fact that the Generic OAuth provider is not linked with my account and that this is why the authorization is invalid.

(Note: I would really appreciate if the verbose logging option provided explicit error messages that indicate WHY the authorizations are invalid for debugging purposes as currently I am left to guessing/reading the source code)

Currently, BetterAuth does not support custom provider ID's for trusted providers:

Type '"authentik"' is not assignable to type '"github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "email-password"'.

I believe that this is an oversight and that those using the Generic OAuth plugin should be able to setup these providers for account linking.

Originally created by @awesomepandapig on GitHub (Nov 16, 2024). I am trying to use the [Generic OAuth](https://www.better-auth.com/docs/plugins/generic-oauth) plugin to provide one-click SSO for my application. Currently, however, I am unable to complete the flow. I can successfully authorize the application and this is what is logged by my SSO provider. ![Screenshot 2024-11-16 113808](https://github.com/user-attachments/assets/6ba73914-12b9-4267-9413-51b564d3a3a1) Once it authorizes and connects to the callback, it does not sign me in and instead gives me the following error: ![image](https://github.com/user-attachments/assets/c5972891-9ae3-4793-9c16-8461695632ce) I assume this is due to the the fact that the Generic OAuth provider is not linked with my account and that this is why the authorization is invalid. **(Note: I would really appreciate if the verbose logging option provided explicit error messages that indicate WHY the authorizations are invalid for debugging purposes as currently I am left to guessing/reading the source code)** Currently, BetterAuth does not support custom provider ID's for trusted providers: ```Type '"authentik"' is not assignable to type '"github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "email-password"'.``` I believe that this is an oversight and that those using the Generic OAuth plugin should be able to setup these providers for account linking.
Author
Owner

@Bekacru commented on GitHub (Dec 3, 2024):

Hey, sorry for getting back to you late. It seems like the issue is failing during verification rather than linking. The error is returned directly from the provider, not from Better Auth. Check if your client ID and client secret are properly configured, and ensure you’ve provided a valid scope.

@Bekacru commented on GitHub (Dec 3, 2024): Hey, sorry for getting back to you late. It seems like the issue is failing during verification rather than linking. The error is returned directly from the provider, not from Better Auth. Check if your client ID and client secret are properly configured, and ensure you’ve provided a valid scope.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#236