Note that there are some explanatory texts on larger screens.

plurals
  1. POHow properly create oauth signature base string?
    primarykey
    data
    text
    <p>I want to implement OAuth 1.0 protocol in order to work with <a href="http://www.copy.com" rel="nofollow">COPY</a>. But when i implemented OAuth protocol in C++ in order to get Request Token and sent that request to copy it's return that signature is invalid and i can't figure out what's wrong in my signature. Here are all parameters that i generate by my program:</p> <pre><code>oauth_nonce=xoviybpokqnxdwlnkeoorawfijgezr oauth_timestamp=1381745375 oauth_callback=http%3A%2F%2Fcopy-oauth.local%2Fget_access_token.php oauth_signature_method=HMAC-SHA1 </code></pre> <p>This is base string that i used in order to generate token:</p> <blockquote> <p>GET&amp;https%3A%2F%2Fapi.copy.com%2Foauth%2Frequest&amp;oauth_consumer_key%3D[my 32 symbols key]%26oauth_nonce%3Dxoviybpokqnxdwlnkeoorawfijgezr%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1381745375%26oauth_tokey%3D</p> </blockquote> <p>It's key for generating signature:</p> <blockquote> <p>[My consumer secret, 48 symbols]&amp;</p> </blockquote> <p>Here is signature that i received after base64 and percent encoded:</p> <blockquote> <p>lNaaOaWyGtkJWj%2BVLjLlKTVGYL0%3D</p> </blockquote> <p>And the last thing is sending all parameters to server. For this purpose i use libcurl:</p> <pre><code>char * abc="https://api.copy.com/oauth/request/?oauth_callback=http%3A%2F%2Fcopy-oauth.local%2Fget_access_token.php&amp;oauth_consumer_key=[my 32 symbols key]&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1381745375&amp;oauth_nonce=xoviybpokqnxdwlnkeoorawfijgezr&amp;oauth_signature=lNaaOaWyGtkJWj%2BVLjLlKTVGYL0%3D"; CURL *curl; CURLcode res; curl_global_init(CURL_GLOBAL_DEFAULT); curl = curl_easy_init(); if(curl) { curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, TRUE); curl_easy_setopt(curl, CURLOPT_CAINFO, "C:\\a\\a\\a\\cacert.pem"); curl_easy_setopt(curl, CURLOPT_URL, abc); res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* always cleanup */ curl_easy_cleanup(curl); } curl_global_cleanup(); </code></pre> <p>Then my console will output:</p> <blockquote> <p>oauth_error_message=oauth_problem%3Dsignature_invalid%26debug_sbs...</p> </blockquote> <p>What's wrong in my implementation?</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. This table or related slice is empty.
    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