Exploring Better Auth SSO Plugin – Guidance on authClient.sso.register Usage
I’ve created a sample repository to explore the usage of the Better Auth SSO plugin.
While working on it, I was unsure about the appropriate placement and timing for calling
Documentation reference: Better Auth SSO Plugin - Register an OIDC Provider
It's worth noting that sensitive information such as
Sample repo: https://github.com/amal-chandran/sso-better-auth
If anyone has a production-ready example or further guidance on implementing this correctly, I’d greatly appreciate it!
While working on it, I was unsure about the appropriate placement and timing for calling
authClient.sso.register, especially since invoking this API requires an active user session. Additionally, there is no implementation provided for signInWithTestUser, which added to the confusion.Documentation reference: Better Auth SSO Plugin - Register an OIDC Provider
It's worth noting that sensitive information such as
clientId and clientSecret should be handled exclusively on the backend.Sample repo: https://github.com/amal-chandran/sso-better-auth
If anyone has a production-ready example or further guidance on implementing this correctly, I’d greatly appreciate it!
Solution
so the sso plugin is meant to be used by allowing users to register a custom provider that can be used later to authenticate user