Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cognito_idp/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def basic_authorization_headers
return if client_secret.nil?

client_id_and_secret = "#{client_id}:#{client_secret}"
{"Authorization" => "Basic #{Base64.urlsafe_encode64(client_id_and_secret)}"}
{"Authorization" => "Basic #{Base64.strict_encode64(client_id_and_secret)}"}
end
end
end
8 changes: 4 additions & 4 deletions spec/cognito_idp/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
Faraday::Adapter::Test::Stubs.new do |stub|
stub.post("https://auth.example.com/oauth2/token") do |env|
id_and_secret = "#{client_id}:#{client_secret}"
basic_auth = "Basic #{Base64.urlsafe_encode64(id_and_secret)}"
basic_auth = "Basic #{Base64.strict_encode64(id_and_secret)}"
fail "Basic Authorization is missing." unless env.request_headers["Authorization"] == basic_auth
[200, {"Content-Type" => "application/json"}, response_payload.to_json]
end
Expand Down Expand Up @@ -204,7 +204,7 @@
Faraday::Adapter::Test::Stubs.new do |stub|
stub.post("https://auth.example.com/oauth2/token", params_matcher) do |env|
id_and_secret = "#{client_id}:#{client_secret}"
basic_auth = "Basic #{Base64.urlsafe_encode64(id_and_secret)}"
basic_auth = "Basic #{Base64.strict_encode64(id_and_secret)}"
fail "Basic Authorization is missing." unless env.request_headers["Authorization"] == basic_auth
[200, {"Content-Type" => "application/json"}, response_payload.to_json]
end
Expand Down Expand Up @@ -325,7 +325,7 @@
Faraday::Adapter::Test::Stubs.new do |stub|
stub.post("https://auth.example.com/oauth2/token") do |env|
id_and_secret = "#{client_id}:#{client_secret}"
basic_auth = "Basic #{Base64.urlsafe_encode64(id_and_secret)}"
basic_auth = "Basic #{Base64.strict_encode64(id_and_secret)}"
fail "Basic Authorization is missing." unless env.request_headers["Authorization"] == basic_auth
[200, {"Content-Type" => "application/json"}, response_payload.to_json]
end
Expand Down Expand Up @@ -373,7 +373,7 @@
Faraday::Adapter::Test::Stubs.new do |stub|
stub.post("https://auth.example.com/oauth2/token", params_matcher) do |env|
id_and_secret = "#{client_id}:#{client_secret}"
basic_auth = "Basic #{Base64.urlsafe_encode64(id_and_secret)}"
basic_auth = "Basic #{Base64.strict_encode64(id_and_secret)}"
fail "Basic Authorization is missing." unless env.request_headers["Authorization"] == basic_auth
[200, {"Content-Type" => "application/json"}, response_payload.to_json]
end
Expand Down