Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Twitter Authentication

New Here ,
Oct 19, 2009 Oct 19, 2009

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.

477
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2009 Oct 22, 2009
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources