2011年12月11日日曜日

続々・Titanium と BirdHouse で TwitterOAuth

まーじーかっ!!
おかげでなぞが解けた。ありがとう。スタックオーヴァフロゥ

んと、BirdHouseをそのまま使うと、
AccessToken取得時に、Accesser に Request_token_secret を入れないようになっている。
これはTwitterには必要ないためだと思う。
なので、
Tumblr や Flickr のOAuthに対応できなくなってしまうので、
利用するサービス名を取得しーの、

function get_access_token(callback) {}
の頭のほうに、
if(cfg.serviceName != "twitter"){accessor.tokenSecret    = cfg.request_token_secret;}
と書けば、万事解決な気持ちがします!

http://stackoverflow.com/questions/8373885/getting-an-oauth-access-token-not-language-specific-same-issue-for-flickr-an



0 down vote accepted
I'll answer my own question.
There were a few discrepancies between the different oauth service provider implementations:
Twitter
  • Expects oauth_callback on request_token step
  • Doesn't return oauth_token_secret until access_token response
  • Therefore, there's an empty oauth_token_secret in signing the access_token request
Flickr & Tumblr
  • Expect oauth_callback on authenticate (i.e. authorize) step
  • Return oauth_token_secret on request_token step (and expect you to remember it and use it to sign access_token request)
Youtube (and other Google OAuth service providers):
  • Expects Google-proprietary "scope" on request_token step
  • Expects oauth_callback on authenticate (i.e. OAuthAuthorizeToken) step
  • Doesn't seem to like oauth_token passed in Authorization header in the access_token step (responds with "token invalid" due to required double-encoding in base string). Pass it in the post body or query string instead.

0 件のコメント:

コメントを投稿