Better Auth Not Respecting OIDC Discovery Document Endpoints with IdentityServer4
Problem Description
When implementing OAuth 2.0/OpenID Connect with IdentityServer4, Better Auth is not using the endpoints from the discovery document despite proper configuration. Instead, it's trying to use its own API structure (
/api/auth/sign-in/oauth2
).
Current Implementation
1. Server Configuration (server.ts
):
2. Client Configuration (client.ts
):
3. API Route Handler ([...auth]+api.ts
):
Expected Behavior
- Better Auth should use the configured OIDC endpoints from the server configuration
- Authentication flow should follow the standard OAuth 2.0/OpenID Connect protocol with IdentityServer4
Actual Behavior
- Better Auth is ignoring the configured endpoints
- Attempting to use its own API structure (/api/auth/sign-in/oauth2
)
- Results in "Request Rejected" errors when trying to authenticate
#help3 Replies