From 829a7d083b0fb2179c3c8dccb0ea6814df5b2442 Mon Sep 17 00:00:00 2001 From: bajajnehaa Date: Tue, 30 Jan 2024 08:31:22 +0000 Subject: [PATCH] chore: Add test case for PKCE support --- spec/signet/oauth_2/client_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/signet/oauth_2/client_spec.rb b/spec/signet/oauth_2/client_spec.rb index 505278a..749c04b 100644 --- a/spec/signet/oauth_2/client_spec.rb +++ b/spec/signet/oauth_2/client_spec.rb @@ -1144,6 +1144,12 @@ def build_form_encoded_response payload }) end + it "should use code_verifier if passed in additional_parameters when generating authorization_uri" do + @client.update! additional_parameters: { code_verifier: "IeJRY4uem0581Lcw6CiZ3fNwngg" } + expect(@client.additional_parameters).to eq ({ code_verifier: "IeJRY4uem0581Lcw6CiZ3fNwngg" }) + expect(@client.authorization_uri.query).to match (/code_verifier=/) + end + it "should merge new authorization_uri custom parameters" do expect(@client.authorization_uri(additional_parameters: { "type" => "new_type", "new_param" => "new_val" }).query_values).to eql({ "access_type" => "offline", "client_id" => "s6BhdRkqt3", "new_param" => "new_val", "response_type" => "code", "redirect_uri" => "https://example.client.com/callback", "type" => "new_type" }) end