Twitter API status update not working when updating to v1.1

戏子无情 提交于 2020-03-25 17:52:59

问题


I have a twitter application which sends tweets automatically for uses of our blog application whenever they post a new blog item.

This application is now returning an error

HTTP/1.1 401 Unauthorized Content-Type: application/json; charset=utf-8 Date: Mon, 12 Nov 2012 22:05:27 UTC Server: tfe

{"errors":[{"message":"Could not authenticate you","code":32}]}

My coldfusion code is as follows for posting the tweet:

<cfset var tweetURL = "https://api.twitter.com/1.1/statuses/update.json">
<cfhttp url="#tweetURL#" method="post" result="result">
    <cfhttpparam type="header" name="Authorization" value="#oauth.header#" encoded="no">
    <cfhttpparam type="formfield" name="status" value="#tweet#" encoded="no">
</cfhttp>

I have dumped out all the oauth header values, they are all as they should be, they are not returning any errors at all. its only the status update that is returning the unauthorized error.

What other things do I need to check? I thought my app may have been blocked or something but its all up and working. I've tested the user accounts they have authorized the app.


回答1:


I worked it out. I was to busy validating the input of the header and auth tokens etc that I overlooked the status. It wasn't urlencoded. although this apparently worked in the old version. it didn't pass for the new.



来源:https://stackoverflow.com/questions/13352433/twitter-api-status-update-not-working-when-updating-to-v1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!