Created
January 27, 2012 14:27
-
-
Save methane/1689029 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://developer.mixi.co.jp/appli/spec/mob/validate-oauth-signature/ を Python で検証してみる。 | |
| In [85]: key | |
| Out[85]: '79e0a55cde43e7dc86fd1e1366d6bd6ac7771db8&' | |
| In [86]: raw | |
| Out[86]: 'GET&http%3A%2F%2Fexample.com%2Ffoo%2F&oauth_consumer_key%3Dbc906fac81f581c3c96a%26oauth_nonce%3D9dc8fbca0e51842e7449%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1254282755%26oauth_version%3D1.0%26opensocial_app_id%3D123%26opensocial_owner_id%3Dxxxxxxxx' | |
| In [87]: import hmac | |
| In [88]: from hashlib import sha1 | |
| In [89]: hmac.new(key, raw, sha1).digest().encode('base64') | |
| Out[89]: 'cv87UdLBj/Jlt0hkqvQ6m2d9XxY=\n' | |
| 一致しない!なんで!? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment