Skip to content

Instantly share code, notes, and snippets.

@alexquick
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexquick/c5d0b88f1f00c35d1a75 to your computer and use it in GitHub Desktop.
Save alexquick/c5d0b88f1f00c35d1a75 to your computer and use it in GitHub Desktop.
oauth HMAC-SHA1 samples

All done with a consumer key and secret of 774b6971bc4c443b8398c77c5d4d3470, 6d5517f5f4524a5da2c88f4e7f6bf971 and an access token and secret of tTvuLYl73ldqhQGv, UPlQlj576q8h3VCP

Below, newlines are added for clarity only.

HMAC-SHA1("6d5517f5f4524a5da2c88f4e7f6bf971&UPlQlj576q8h3VCP",
"GET&https%3A%2F%2Fapi.appfigures.com%2Fv2%2F&
  oauth_consumer_key%3D774b6971bc4c443b8398c77c5d4d3470%26
  oauth_nonce%3D0cc9d722c46841dba26822d6f0f855b76264ea45%26
  oauth_signature_method%3DHMAC-SHA1%26
  oauth_timestamp%3D1406569285%26
  oauth_token%3DtTvuLYl73ldqhQGv%26
  oauth_version%3D1.0")

=> "y7RV/d1smpCbuosLyxlnUwkM6Nc="
HMAC-SHA1("6d5517f5f4524a5da2c88f4e7f6bf971&UPlQlj576q8h3VCP",
  "GET&https%3A%2F%2Fapi.appfigures.com%2Fv2%2Fproducts%2Fmine&
   oauth_consumer_key%3D774b6971bc4c443b8398c77c5d4d3470%26
   oauth_nonce%3D1406570631.37%26
   oauth_signature_method%3DHMAC-SHA1%26
   oauth_timestamp%3D1406570631%26oauth_token%3DtTvuLYl73ldqhQGv")

=> "FwNfyE1DT7HyzQaBRXDwA8JeH9I="```

And the final request looks like:

https://api.appfigures.com/v2/products/mine?oauth_consumer_key=774b6971bc4c443b8398c77c5d4d3470&
  oauth_nonce=1406570631.37&
  oauth_signature_method=HMAC-SHA1&
  oauth_timestamp=1406570631&
  oauth_token=tTvuLYl73ldqhQGv&
  oauth_signature=FwNfyE1DT7HyzQaBRXDwA8JeH9I=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment