強火で進め

このブログではプログラム関連の記事を中心に書いてます。

TwitterのOAuth認証を使う


(2010/06/18 )
OAuth816


moving the OAuth switch over date to august 16, 2010 - Twitter Development Talk | Google 
http://groups.google.com/group/twitter-development-talk/browse_thread/thread/dfb89d9f29f339a2?pli=1
 

831BASIC使


Twitter: Twitter API (oAuth)
http://blog.twitter.jp/2010/06/twitter-api-oauth.html
 

2010630TwitterTwitter APIBASIC使


TwitterBASIC - ITmedia 
http://www.itmedia.co.jp/enterprise/articles/1004/28/news012.html
 

Twitter API使OAuthxAuth
TwitterxAuth使xAuth

OAuthxAuthOAuth使

OAuthTwitter



 2010/05/20 

アプリの登録申請


twitterOAuth
http://twitter.com/oauth_clients








選択項目 説明
クライアントプリケーション 実行ファイルを起動するようなディスクトップ系のアプリのときに選択します。
ブラウザアプリ ブラウザで動作するアプリのとき選択します。こちらを選択した場合、ユーザによるOauth認証の承認が完了した後に表示するURLを指定する事が出来ます。




Default Access type
稿Read & WriteRead-only

OAuth-

ライブラリ


OAuth使


bengottlieb's Twitter-OAuth-iPhone at master - GitHub
http://github.com/bengottlieb/Twitter-OAuth-iPhone
 

DL(git)
git clone http://github.com/bengottlieb/Twitter-OAuth-iPhone.git

DL Demo 

Code OAuthTwitterDemoViewController.m 2Consumer keyConsumer secret
#define kOAuthConsumerKey    @""  //REPLACE ME
#define kOAuthConsumerSecret   @""  //REPLACE ME


 OAuthTwitterDemoViewController.m  - viewDidAppear: 

 _engine  SA_OAuthTwitterEngine 

 SA_OAuthTwitterController  SA_OAuthTwitterController  + controllerToEnterCredentialsWithTwitterEngine:delegate:  nil 
 UIViewController   *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];

OAuth稿
 if (controller) 
  [self presentModalViewController: controller animated: YES];
 else {
  [_engine sendUpdate: [NSString stringWithFormat: @"Already Updated. %@", [NSDate date]]];
 }

1 else 稿 NSLog 

稿 MGTwitterEngine.h 
#pragma mark REST API methods

OAuthOAuth使

ビルド


使Xcode()(fainal)使
Undefined symbols:
  "_OBJC_CLASS_$_OAConsumer", referenced from:
      objc-class-ref-to-OAConsumer in SA_OAuthTwitterEngine.o
  "_OBJC_CLASS_$_OAToken", referenced from:
      objc-class-ref-to-OAToken in SA_OAuthTwitterEngine.o
  "_OBJC_CLASS_$_OAMutableURLRequest", referenced from:
      objc-class-ref-to-OAMutableURLRequest in SA_OAuthTwitterEngine.o
  "_OBJC_CLASS_$_OADataFetcher", referenced from:
      objc-class-ref-to-OADataFetcher in SA_OAuthTwitterEngine.o
  "_OBJC_CLASS_$_OARequestParameter", referenced from:
      objc-class-ref-to-OARequestParameter in SA_OAuthTwitterEngine.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

WebView

PIN7TextFieldTwitterHTML(twitterREST API)


Twitter API Wiki / Authentication
http://apiwiki.twitter.com/Authentication
 

IDOAuthOAuthID稿

おまけ

なお、twitterのサーバから返される情報のパースは以下の id:tomute さんのサイトで丁寧な解説が有るJSON Frameworkなどを使うと簡単に行えてオススメです。

Objective-CJSON Frameworkを使ってTwitterの情報等を取得する方法 - Tomute’s Notes
http://d.hatena.ne.jp/tomute/20090518/1242687954

関連情報

OAuth関連の専門用語 - 強火で進め
http://d.hatena.ne.jp/nakamura001/20100531/1275329032

やる夫で学ぶOAuth 〜やる夫がユニクロの行列に並んだようです〜 - くらげのBlog
http://d.hatena.ne.jp/ku__ra__ge+blog/20100531/1275331398

OAuthプロトコルの中身をざっくり解説してみるよ - ゆろよろ日記
http://d.hatena.ne.jp/yuroyoro/20100506/1273137673

Yahoo!デベロッパーネットワーク - OAuth - フロー
http://developer.yahoo.co.jp/other/oauth/flow.html

OAuth Core 1.0
http://oauth.net/core/1.0/#anchor9

iPhoneTwitter OAuth認証の流れについて » いとーけーのページ
http://itok.jp/blog/2010/01/13/iphone_twitter_oauth_gui/

OAuthやxAuthなどもについての解説が書いてあるTwitter APIの解説本。
日頃からTwitter APIをよく使っている方が書かれた本という印象で「twitterの負荷で挙動が…」などの体験に基づいた情報も有る実践的な内容でした。

Twitter API プログラミング

Twitter API プログラミング

xAuthの申請についてはこちらサイトが参考になります。最初は1週間の期限付きになるなど色々と注意すべき事が有る様です。

xAuthの申請方法をまとめました
http://blog.elearning.co.jp/?p=8909

Twitter-OAuth-iPhoneを使ってcocos2dプロジェクトからゲーム情報をpostする - 〜けものみちを目指して〜Only the Paranoid Survive
http://d.hatena.ne.jp/jarinosuke0808/20101019/1287496640

TwitPicのOAuthEcho対応 | iphoneアプリで稼げるのか
http://iphone.longearth.net/2010/08/05/twitpic%E3%81%AEoauthecho%E5%AF%BE%E5%BF%9C/

Twitter API を OAuth で認証するスクリプトを 0 から書いてみた - trial and error
http://techno-st.net/2009/11/26/twitter-api-oauth-0.html