White scenery @showyou, hatena

If you have any comments, you may also send twitter @shsub or @showyou.

OAuthのパラメータはsortしてないとダメって話

ついコメント欄のコードだけ見てつっこんでから気づいたけど、OAuthのどこに「ソートしてから結合したい辞書」が出てくるんだ?

http://d.hatena.ne.jp/nishiohirokazu/20100929/1285762532

OAuth関連のパラメータ(oauth_signature_methodとかoauth_nonceとか)のsignatureを計算するときは、を送るときにはパラメータをソートして置かないとハッシュ値が変わって一致しなくなってしまいます。(thx, s!)


って経験則で言ってもアレなのでソース調べてみた。

こう言うのはRFC見るのが一番いいんですかねー。

http://oauth.net/documentation/から、http://tools.ietf.org/html/rfc5849#section-3.5.1

They are then sorted and encoded in a
particular manner that is often different from their original
encoding scheme, and concatenated into a single string.

あと3.4.1.3.2. Parameters Normalizationには図で書かれてたりとかしますね。