Open wsmoak opened 4 years ago
We just ran into this problem as well.
A better solution might would be to use Bearer
authentication, which is supported by the Stripe API as well.
This is the problematic line: https://github.com/activemerchant/active_merchant/blob/8b5d2ac8abc859246c8ce3fc0b9c3d2fe5d46bb4/lib/active_merchant/billing/gateways/stripe.rb#L616
Changing this line to the following would repair the error and not require string replacement / newline stripping on the base64 output:
'Authorization' => 'Bearer ' + key.to_s,
We are now seeing this issue popup as well on newer Stripe accounts.
Any plans to push out a PR?
We recently started seeing "header field value cannot include CR/LF" when attempting to use Stripe.
This is the problematic line: https://github.com/activemerchant/active_merchant/blob/8b5d2ac8abc859246c8ce3fc0b9c3d2fe5d46bb4/lib/active_merchant/billing/gateways/stripe.rb#L616
Apparently Stripe has started issuing secret keys (access tokens) that are much longer, and the plain
encode64
method will insert newlines in long strings.The fix is to switch to the
strict_encode64
method, which does not.This article helped us find the problem: https://stackoverflow.com/questions/2620975/strange-n-in-base64-encoded-string-in-ruby
Looks like this was already committed a few weeks ago:
After updating my ActiveMerchant gem the new stripe accounts are now working.
We recently started seeing "header field value cannot include CR/LF" when attempting to use Stripe.
This is the problematic line: https://github.com/activemerchant/active_merchant/blob/8b5d2ac8abc859246c8ce3fc0b9c3d2fe5d46bb4/lib/active_merchant/billing/gateways/stripe.rb#L616
Apparently Stripe has started issuing secret keys (access tokens) that are much longer, and the plain
encode64
method will insert newlines in long strings.The fix is to switch to the
strict_encode64
method, which does not.This article helped us find the problem: https://stackoverflow.com/questions/2620975/strange-n-in-base64-encoded-string-in-ruby