Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Secretless auth in the OpenID connect plugin (#35606)

Justin Moore4bb513fccf49
diff --git a/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb b/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb
index 410a88f46dc..48c4ec9856e 100644
--- a/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb
+++ b/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb
@@ -73,6 +73,11 @@ module OmniAuth
)
options[:client_options][:auth_scheme] = :request_body
end
+
+ # If we're using PKCE _and_ there is no client_secret, use the request_body auth_scheme.
+ if options[:pkce] && (options[:client_secret].nil? || options[:client_secret].empty?)
+ options[:client_options][:auth_scheme] = :request_body
+ end
end
def request_phase