【发布时间】:2018-09-18 22:35:59
【问题描述】:
我正在尝试使用 Signet::Oauth2::Client 从 getresponse.com 获取访问令牌
client = Signet::OAuth2::Client.new(
client_id: GET_RESPONSE_CLIENT_ID,
client_secret: GET_RESPONSE_CLIENT_SECRET,
token_credential_uri: 'https://api.getresponse.com/v3/token',
redirect_uri: my_callback_uri,
grant_type: 'authorization_code',
code: the_code_i_got_from_get_response
)
response = client.fetch_access_token!
但是 Get Response 总是返回这个:
{"error"=>"invalid_client", "error_description"=>"Client credentials were not found in the headers"}
我用 curl 轻松完成了这个请求。它使用令牌成功返回。
curl -v -u client_id:client_secret https://api.getresponse.com/v3/token -d "grant_type=authorization_code&code=abc123thisisthecode&redirect_uri=https://myserver.com/callback"
我已经尝试了一百万件事并阅读了客户端源代码,但我没有看到我做错了。我将继续阅读文档,但同时我想我会在 stackoverflow 上向专业人士提问。有人知道答案吗?这是api文档https://apidocs.getresponse.com/v3/oauth2
【问题讨论】:
标签: ruby-on-rails ruby oauth-2.0 google-oauth getresponse