tw2mvをTwitterのxAuthに対応させたメモ
TwitterのBasic認証が6月末に終了するということで、やっとこさmixiボイスへの転送スクリプト"tw2mv"をxAuthに対応させてみました。 xAuthはOAuthの簡易版ですので、可能な限りOAuthで実装するのが筋だと思います。 ただ、本スクリプトはコマンドラインスクリプトのため、OAuthでWebの画面を開いて認証させるのは余計な手間がかかると判断しxAuthを採用しています。 1. Twitterへのアプリケーション登録 通常のOAuth利用と同じく、ConsumerKeyが必要なのでアプリケーションの申請を行います。 https://twitter.com/apps/new クライアントアプリケーションなので「あなたの招待状」の部分を「送信」で登録。(日本語訳がおかしいですね。。) 2. xAuthの利用申請メール Using xAuth | dev.twitter.com xAuth access is restricted to approved applications. If your application is a desktop or mobile application and the standard web OAuth flow or PIN-code out-of-band flow is not right for you, send a detailed message to [email protected] to request xAuth privileges. Include the name of your application, the consumer key, the application ID (if available), and a summary of how xAuth is best-suited for your application. [email protected]宛にメールで利用の申請をしてねとのことなので、メール(英語)でお伺いを立てました。 To: [email protected] Subject: xauth request Hello. I'm a developer of "tw2mv". "tw2mv" is a php script, for sync messages between twitter and "mixi voice". ("mixi voice" is twitter-like service, in japanese SNS "mixi". Please apply this app to use xAuth. Application Name: tw2mv App Source Code : http://github.com/nojimage/twitter2mixivoice My account : @nojimage Thank you. タイミングもあったと思いますが、申請から8hで承認がおりました。thanks! (よく見たら、ConsumerKeyもメールに書いておいてねとある。。 3. OAuthライブラリ pearのHTTP_OAuthを利用しました。 pear install HTTP_OAuth-0.1.10 [ad] ...