我正在尝试使用twitter api接受受保护帐户的关注请求 我已经使用oAuth来验证自己,并且所有api端点都按预期工作 但是当我尝试使用http://api.twitter.com/1/friendships/accept.json时 我收到以下回复:
{"errors":[{"code":37,"message":"Not authorized to use this endpoint"}]}
是的,它是一个POST端点,而不是GET
必须有办法解决这个问题。还有其他应用程序可以通过某种方式解决这个问题。
请帮忙。
TIA
额外信息:
我在Fiddler看到的帖子:
POST https://api.twitter.com/1/friendships/accept.json HTTP/1.1
Authorization: OAuth oauth_timestamp="1307086335",oauth_nonce="CxZOu9zk3IqlRMQ3s",oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="hK6dftsut8UgUICrb8d1Yw",oauth_token="304415306-yabqGaJiEOEx8NYGC7qXttoJyEbA7ycQILBKY",oauth_signature="zFtCNYzOU8XbVVHAymazkltW4Xs%3D"
Content-Type: application/x-www-form-urlencoded
Host: api.twitter.com
Content-Length: 16
Connection: Keep-Alive
user_id=45807474
这是由Fiddler捕获的Twitter:
POST http://api.twitter.com/1/friendships/accept.json HTTP/1.1
Host: api.twitter.com
Proxy-Connection: keep-alive
Referer: http://api.twitter.com/receiver.html
Content-Length: 81
Origin: http://api.twitter.com
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.71 Safari/534.24
Content-Type: application/x-www-form-urlencoded
Accept: application/json, text/javascript, */*; q=0.01
X-Phx: true
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: guest_id=130451073302552267; __utmz=43838368.1304689370.3.3.utmcsr=mybroadband.co.za|utmccn=(referral)|utmcmd=referral|utmcct=/news/cellular/19383-Android-paid-market-arriving-South-Africa.html; __qca=P0-701205957-1307007945635; original_referer=JbKFAfGwv4RwApvTLqS%2BuSg2nN6n6Sc2FNg%2B%2FJZdApHOHiilCO8gnQ%3D%3D; auth_token=d2f0d92a931cf954727bf6667cf38f48cb1e75f1; twid=u%3D304415306%7CUtwJgOgbvSsO8QsBhX7fM3JpcQ4%3D; twll=l%3D1307013065; external_referer=ZLhHHTiegr9ziOY2WC22JyCEc9mRpioNrN9gRZ8lMqQakz1ge%2BROzRwTTLv60GEo; k=196.33.166.196.1307022588816189; __utma=43838368.1872776221.1299681259.1307079974.1307086527.9; __utmc=43838368; __utmv=43838368.lang%3A%20en; __utmb=43838368.6.10.1307086527; lang=en; _twitter_sess=BAh7DToVaW5fbmV3X3VzZXJfZmxvdzA6CXVzZXJpBEoCJRI6DGNzcmZfaWQi%250AJWM3Zjc4ZTc4NmE0ZDFkZjRlYzEzOTNhM2QyYzkxNjdhOg5yZXR1cm5fdG8i%250AKGh0dHA6Ly90d2l0dGVyLmNvbS9zZXR0aW5ncy9hY2NvdW50OhNwYXNzd29y%250AZF90b2tlbiItZDJmMGQ5MmE5MzFjZjk1NDcyN2JmNjY2N2NmMzhmNDhjYjFl%250ANzVmMToPY3JlYXRlZF9hdGwrCJb7nVAwAToHaWQiJTU4ZmU0OGYzMTM4OWQy%250AMDAwMWE5Y2M5ZjRjZTUzZjM1IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy%250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--fe9109485afb838e1b09c7425e205f3dea7a23aa
user_id=45807474&post_authenticity_token=96bc19d60674d226e5a5125995de8748035dea6f
它们似乎在标题中有更多细节,它们也传递一个名为的变量 post_authenticity_token 希望额外的细节能够为这个问题带来更多的启示。
答案 0 :(得分:2)
我遇到过这个问题before,这是Twitter的API的一个错误。我发现工作的临时解决方案是切换到https。您还应file a bug向Twitter报告。
更新:friendships/accept
不是官方Twitter API方法。我以为Twitter已经实现了它,但他们没有。您必须让用户访问twitter.com以授权关注者。您可以在dev.twitter.com上查看Twitter的支持API方法。