tig.rbをOAuthに対応させてみた
これからはTwitterクライアントもOAuthに対応してかないといけないらしいですよ。参考: Twitter APIのBASIC認証は2010年6月に「廃止予定」(→8月まで延長)(→廃止された模様) - 頭ん中。
というわけで、tig.rbをOAuthに対応させてみました。
使い方
(1) OAuth対応版のtig.rbを入手
OAuthに対応させたtig.rbはGitHub - mzp/net-irc at oauthにあります。
gitコマンドの使える人は、以下のように取得できます。
$ git clone git://github.com/mzp/net-irc.git -b oauth
gitコマンドの無い人は、tarballをどうぞ。
(2) 認証用のURLを取得する
tig.rbを--oauth
オプションをつけて起動します。
$ ruby examples/tig.rb --oauth Access this URL and approve => http://twitter.com/oauth/authorize?oauth_token=hogehoge Input OAuth Verifier:
(4) 認証用の数字を入力する
認証用の数字が表示されます。
これを先程のInput OAuth Verifierのところに入力します。
$ ruby examples/tig.rb --oauth Access this URL and approve => http://twitter.com/oauth/authorize?oauth_token=hogehoge Input OAuth Verifier: 5298385 Please add 'oauth=fugafuga'
(5)ユーザ名にoauth=fugafugaを追加する
表示されたoauth=fugafugaをtig.rbにログインするときのユーザ名に追加します。
Tiarraの設定ファイルだと、こんな感じになるはずです。
twitter { host: localhost port: 16668 name: username oauth=fugafuga password: password in-encoding: utf8 out-encoding: utf8 }
おわび
認証用コードを入れてもらう処理を、うまく組込めませんでした。
なので、--oauthオプションという面倒なものが必要になってしまいました。
ごめんなさい。