Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Pseudocodish:</p> <pre><code>def sign_request(): from hashlib import sha1 import hmac # key = CONSUMER_SECRET&amp; #If you dont have a token yet key = "CONSUMER_SECRET&amp;TOKEN_SECRET" # The Base String as specified here: raw = "BASE_STRING" # as specified by oauth hashed = hmac.new(key, raw, sha1) # The signature return hashed.digest().encode("base64").rstrip('\n') </code></pre> <p>Signature errors usually reside in the base-string, make sure you understand this (as stated by the OAuth1.0 spec here: <a href="http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1" rel="noreferrer">http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1</a>).</p> <p>The following inputs are used to generate the Signature Base String:</p> <ol> <li>HTTP Method (for example GET)</li> <li>Path (for example <a href="http://photos.example.net/photos" rel="noreferrer">http://photos.example.net/photos</a>)</li> <li><p>Parameters, alphabetically, such as (line breaks for readability): </p> <pre><code>file=vacation.jpg &amp;oauth_consumer_key=dpf43f3p2l4k3l03 &amp;oauth_nonce=kllo9940pd9333jh &amp;oauth_signature_method=HMAC-SHA1 &amp;oauth_timestamp=1191242096 &amp;oauth_token=nnch734d00sl2jdk &amp;oauth_version=1.0 &amp;size=original </code></pre></li> </ol> <p>Concatenate and URL encode each part and it ends up as:</p> <p><code>GET&amp;http%3A%2F%2Fphotos.example.net%2Fphotos&amp;file%3Dvacation.jpg%26 oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26 oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26 oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload