-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stripe::OAuth.token is broken #866
Comments
Hi @volkanunsal. According to the error message, it sounds like the API key sent in the |
Yes, it's the same key. The |
🤔 Just to be 100% sure, you're using the same |
Absolutely, positively certain. |
Try it yourself. I'll change this secret key soon. And it's just a test key anyway. First try the Ruby code, then the curl code. |
I pasted the wrong code. |
That exact code you pasted actually works for me, haha. I think the problem might be something like you having a different I can repro the error by setting @ob-stripe I may have broken this in the V5 refactor. Do you know if the idea for the OAuth module was that we should never send the global API key? |
Oh, that helps. Yes, I can see that the global key is different. |
Ohh, okay, I think I see what's happening. The |
Very helpful. Thank you all. You can close this issue anytime you like. |
This is arguably an actual bug with the client library (and I suspect most/all of our client libraries for other languages have the same issue), if only because the behavior is very non-obvious and confusing. We should probably omit the def self.token(params = {}, opts = {})
opts = Util.normalize_opts(opts)
+ opts[:api_key] = params[:client_secret] if params[:client_secret]
resp, opts = OAuthOperations.request(
:post, "/oauth/token", params, opts
)
# This is just going to return a generic StripeObject, but that's okay
Util.convert_to_stripe_object(resp.data, opts)
end @brandur-stripe wdyt? |
Yep, my thought process was ~identical. I'd prefer just not to include an API key at all, but this line in api_key ||= Stripe.api_key We could have some dummy value that tells the client not to set it, but ugh. I think your solution is probably the best — the secret gets doubled up in both the header and |
Fixed in 5.12.1. Sorry it took us so long! |
I'm noticing that this endpoint doesn't work in version 5.1.1. Using
curl
, I can exchange the OAuth token easily:But this doesn't work with the Ruby client:
Here is the error:
The text was updated successfully, but these errors were encountered: