■ 目的
twitterベースなマフィアゲームのおかげで一気に話題になったOAuth。
ここまできたら、みなさんにもっと詳しく知ってもらいたいということで、以下2つのサービスが実装したOAuthの仕様を見直してみます。
- twitter : http://apiwiki.twitter.com/Twitter-API-Documentation
- FriendFeed : http://friendfeed.com/api/documentation
以下、OAuthをいくつかのステップに分けて仕様を見ていきます。
■ Consumer登録
必要な情報
- Application Icon
- Application Name
- Description
- Application Website
- Organization
- Website
- Application Type
- Callback URL
- Default Access type : ★Scope
- Use Twitter for login
- Application name
- Application web site
- Application type
- OAuth Callback URL : 戻り先URL(Browser Appの場合)
- Feedback group : ★ConsumerアプリへのFeedBack用のグループ
Feedback Groupは面白いですね。
しかし、Scopeの概念がないのか?
■ ConsumerKey/Signatureの仕様
twitter,FriendFeed両方とも同じ仕様。
■ OAuth Core 1.0関連
Clientアプリのほうで以下のような説明文がある。
Desktop Clients
The traditional OAuth flow for desktop clients can be cumbersome. We've created a PIN-based experience for destkop clients that use the following flow:
1. The application uses oauth/request_token to obtain a request token from twitter.com.
http://apiwiki.twitter.com/Authentication
2. The application directs the user to oauth/authorize on twitter.com.
3. After obtaining approval from the user, a prompt on twitter.com will display a 7 digit PIN.
4. The user is instructed to copy this PIN and return to the appliction.
5. The application will prompt the user to enter the PIN from step 4.
6. The application uses the PIN as the value for the oauth_verifier parameter in a call to oauth/access_token which will verify the PIN and exchange a request_token for an access_token.
7. Twitter will return an access_token for the application to generate subsequent OAuth signatures.
結果的には、「RevisionAに微妙に対応」ってとこでしょうか。
1. Register your application with FriendFeed to get a Consumer Key and Consumer Secret.
http://friendfeed.com/api/documentation#authentication
At the time of registration, you will also specify a Callback URL (the URL we redirect users to after authorization).
We do not support the oauth_callback parameter for security reasons.
両方とも、あらかじめcallback_urlを1つに指定しているので、書き換えられてなんとかかんとかされることはない。
ブラウザアプリの場合はRequest Token取得時に指定する必要がないようだ。
FriendFeedにはRevisionA,oobなどの記述がないので対応していないっぽいです。
■ Login/Concent Page
キャプチャをはっつけました。
□ twitter(未ログイン)
□ twitter(ログイン済み)
twitterに関しては説明省略します。
□ FriendFeed(未ログイン)
未ログイン状態のときにはちょっと説明のあるログイン画面が出てきます。この1画面で完結しないところはGoogleっぽいところがありますね。
□ FriendFeed(未ログインのログイン後、ログイン済み)
アプリ名、アプリのURLが表示されます。
また、アカウントとコネクトするとアプリは次のようなことができるって書いてあります。
- プロフィールと全てのFeedへのアクセス
- あなたの代わりのFriendFeedへのPOST
APIの各機能まで見ていないのでこの説明で足りているかわかりませんが、twitterよりは親切なのかなぁ。
設定変更をするためのリンク(Applications page)も提示していますね。
■ 使えるAPI
ほぼ全部(省略)
(1) Reading data from FriendFeed
- /feed(認証不要) http://friendfeed-api.com/v2/feed/ritou?pretty=1
- /search(認証不要) http://friendfeed-api.com/v2/search?q=r-weblife&pretty=1
- /picture(認証不要) http://friendfeed-api.com/v2/picture/bret?size=medium
- /feedlist
- /feedinfo(認証不要) http://friendfeed-api.com/v2/feedinfo/ritou?pretty=1
- /entry(認証不要) - Read an entry
- /comment(認証不要) - Read a comment
- /url(認証不要のと必要なの両方?) - Fetch entries about a URL or host
- /short(認証不要) - Get info about an ff.im URL
(2) Publishing to FriendFeed
- /entry - Create, edit, or delete an entry
- /comment - Create, edit, or delete a comment
- /like - Create or delete a like
- /subscribe - Subscribe to a feed
- /unsubscribe - Unsubscribe from a feed
- /feedinfo - Update profile information
- /hide - Hide an entry
- /short - Create an ff.im URL
■ まとめ
Feedback用のGroupってのが面白そう。
twitterにこれあったらMobsterなんとかのところは日本人からの書き込みで炎上してたのかも。
UIではFriendFeedが親切な気がするが、Scopeのようなものが1つしかないため、ユーザーの同意を得たConsumerアプリはなんでもできる。
FriendFeedにはDMみたいなものがないので問題にはならないのかも。
■ おまけ
FriendFeedのドキュメントに、「Installed Application Authentication」って書いてある部分が気になる。
これは、OAuthのリクエストにID/PWを組み合わせたFriendFeed独自仕様のようです。
言い換えると、CredentialはID/PWなんだけどリクエストはOAuthの形式っていう。