Sunday, September 19, 2010

Doing the Oauth dance

If you're setting up Bitlbee and using the ircii client, you may have a bit of difficulty in figuring out how to authenticate to Twitter via Oauth. After authenticating to Bitlbee (via the "identify" command), adding the Twitter account is easy:

  account add twitter YOURNICK YOURPASSWD

Next, figure out the account ID by running:

  account list

Assuming that it's the first account (ID == 0), turn on the account via:

  account 0 on

This will spit up a message similar to:

  twitter - Logging in: Requesting OAuth request token
  *twitter_packetgeek* To finish OAuth authentication, please visit
  https://api.twitter.com/oauth/authorize?oauth_token=1XXmRFAnx

  loyC70HKx9iOcYhoQ5MzpKeqH4 Ds1JrA8&oauth_token
  _secret=47UgTxtpvrKAdpmnC8MybgbGrvgDsaGDQo0fBeaOV
  ao&oauth_callback_confirmed=true and respond with the resu
  lting PIN code.


Please note that everything after *twitter_packetgeek* in the above is all on one line.

You'll want to make note of the handle located between the *'s in the second line (in my case, twitter_packetgeek). Copy and paste the URL into your browser (you may need to log into Twitter) and click allow. This will give you a number to paste into the irc client.

Here's the undocumented part for the irc client: you need to MSG the twitter_packetgeek account with the token. Do this via:

  /msg twitter_packetgeek XXXXXXX

where "XXXXXXX" is the number generated by Twitter's Oauth.