I have started twitter API testing while creating an OAuth
signature the response showing is
{“errors”:[{“code”:215,”message”:”Bad Authentication data.”}]}
Added all the params and headers mention in the doc, and not getting the correct result, please let me know if i am doing anything wrong.
<cfset status = "Hello Ladies + Gentlemen, a signed OAuth">
<cfset include_entities = true >
<cfset oauth_consumer_key = "x3OgJNjJ5TPGj7jyvLz9rUzfU">
<cfset oauth_nonce = createUUID()>
<cfset oauth_signature_method ="HMAC-SHA1" >
<cfset oauth_timestamp = GetTickCount()/1000>
<cfset oauth_token = "1196333045885702145-BPWGfPyKakezuqYoLaYXiIgQ5TWAkf">
<cfset oauth_version = "1.0">
<cfset parameterString = "include_entities=true&oauth_consumer_key=#oauth_consumer_key#&oauth_nonce=#oauth_nonce#&oauth_signature_method=#oauth_signature_method#&oauth_timestamp=#oauth_timestamp#&oauth_token=#oauth_token#&oauth_version=1.0&status=#urlEncodedFormat(status)#" >
<cfdump var="#parameterString#">
<cfhttp url="https://api.twitter.com/1.1/statuses/update.json" method="POST" >
<cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded">
<cfhttpparam type="header" name="mimetype" value="application/x-www-form-urlencoded" />
<cfhttpparam type="header" name="Accept" value="*/*" />
<cfhttpparam type="header" name="Connection" value="close" />
<cfhttpparam type="header" name="Host" value="api.twitter.com" />
<cfhttpparam type="header" name="User-Agent" value="OAuth gem v0.4.4" />
<cfhttpparam type="header" name="Content-Length" value="76">
<cfhttpparam type="header" name="include_entities" value="#include_entities#">
<cfhttpparam type="header" name="oauth_consumer_key" value="#oauth_consumer_key# ">
<cfhttpparam type="header" name="oauth_nonce" value="#oauth_nonce#">
<cfhttpparam type="header" name="oauth_signature_method" value="#oauth_signature_method#">
<cfhttpparam type="header" name="oauth_timestamp" value="#oauth_timestamp#">
<cfhttpparam type="header" name="oauth_token" value="#oauth_token#">
<cfhttpparam type="header" name="oauth_version" value="#oauth_version#">
<cfhttpparam type="header" name="status" value="#urlEncodedFormat(status)#">
<cfhttpparam type="body" value="#parameterString#" >
</cfhttp>
<cfdump var="#cfhttp#"><cfabort>
2
Answers
use this method, it would work correctly
Refer this and Create your developer account on twitter,by your own key, ouath will work.refer this create secret key for oauth