fix(coderd/oauth2provider): support client_secret_basic client auth (#21793)

This commit is contained in:
Thomas Kosiewski
2026-02-02 16:01:33 +01:00
committed by GitHub
parent 09453aa5a5
commit dd6aec04d7
6 changed files with 216 additions and 8 deletions
+6
View File
@@ -503,6 +503,12 @@ func OneWayWebSocketEventSender(log slog.Logger) func(rw http.ResponseWriter, r
// WriteOAuth2Error writes an OAuth2-compliant error response per RFC 6749.
// This should be used for all OAuth2 endpoints (/oauth2/*) to ensure compliance.
func WriteOAuth2Error(ctx context.Context, rw http.ResponseWriter, status int, errorCode codersdk.OAuth2ErrorCode, description string) {
// RFC 6749 §5.2: invalid_client SHOULD use 401 and MUST include a
// WWW-Authenticate response header.
if status == http.StatusUnauthorized && errorCode == codersdk.OAuth2ErrorCodeInvalidClient {
rw.Header().Set("WWW-Authenticate", `Basic realm="coder"`)
}
Write(ctx, rw, status, codersdk.OAuth2Error{
Error: errorCode,
ErrorDescription: description,