Skip to main content
Participant
October 19, 2009
Question

Twitter Authentication

  • October 19, 2009
  • 1 reply
  • 504 views

How are you encoding your username and password strings when accessing the Twitter API? I have tried the following with no success (401 unauthorized):

<cfhttp url="http://twitter.com/statuses/update.xml" method="POST" username="#variables.twitUN#" password="#variables.twitPW#" charset="UTF-8" timeout="30">
    <cfhttpparam type="HEADER" name="Authorization" value="Basic #ToBase64(variables.twitUN & ':' & variables.twitPW)#">
    <cfhttpparam type="FORMFIELD" name="status" value="#CharsetEncode(CharsetDecode(variables.twitStatus, 'utf-8'), 'utf-8')#">
</cfhttp>

Any insight would be greatly appreciated, thank you.

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 22, 2009

    You could try specifying a USERAGENT in yout <cfhttp> call.  I've found some services don't like HTTP requests that don't seem to originate from a browser. I've never used Twitter, so I don't know if it's the case here, but it's easy enough to give it a go and find out.

    --

    Adam