我试图验证我的菲尼克斯框架/灵丹妙药后端的twitter数字api .当我使用curl时它是成功的,但是我真的不知道如何使用HTTPotion生成它.我尝试了不同的组合,但总是返回"215",“坏身份验证数据”。
这是我使用curl时的代码
curl --get 'https://api.digits.com/1.1/sdk/account.json' --header 'Authorization: OAuth oauth_signature="my-oauth-signature",oauth_nonce="my-oauty-nonce",oauth_timestamp="my-oauth-timestamp",oauth_consumer_key="my-oauth-consumer-key",oauth_token="my-oauth-token",oauth_version="1.0",oauth_signature_method="HMAC-SHA1"' -v
到目前为止,这是我尝试使用HTTPotion做的事情,但仍然没有运气。
HTTPotion.get "https://api.digits.com/1.1/sdk/account.json", [headers: ["Authorization": "OAuth", "oauth_consumer_key": "my-oauth-consumer-key", "oauth_nonce": "my-oauth-nonce", "oauth_signature": "my-oauth-signature", "oauth_signature_method": "HMAC-SHA1", "oauth_timestamp": "my-oauth-timestamp", "oauth_token": "my-oauth-token", "oauth_version": "1.0"]]
我找了好几天,但什么也没找到.谁来帮帮我..。
发布于 2016-07-14 11:43:22
该curl
命令只创建一个Authorized
头,而不是像HTTPotion
代码那样的多个头。
这应该是可行的:
HTTPotion.get("https://api.digits.com/1.1/sdk/account.json",
[headers: ["Authorization": ~s|OAuth oauth_signature="my-oauth-signature",oauth_nonce="my-oauty-nonce",oauth_timestamp="my-oauth-timestamp",oauth_consumer_key="my-oauth-consumer-key",oauth_token="my-oauth-token",oauth_version="1.0",oauth_signature_method="HMAC-SHA1"|]])
https://stackoverflow.com/questions/38382553
复制相似问题