Re: Calculating the signature value (oauth_signature)

41 views
Skip to first unread message
Message has been deleted

webm...@adefwebserver.com

unread,
Dec 11, 2022, 6:34:02 PM12/11/22
to FatSecret Platform API
/// <summary>
/// Generates a signature using the HMAC-SHA1 algorithm
/// </summary>        
/// <param name="url">The full url that needs to be signed including its non OAuth url parameters</param>
/// <param name="consumerKey">The consumer key</param>
/// <param name="consumerSecret">The consumer seceret</param>
/// <param name="token">The token, if available. If not available pass null or an empty string</param>
/// <param name="tokenSecret">The token secret, if available. If not available pass null or an empty string</param>
/// <param name="httpMethod">The http method used. Must be a valid HTTP method verb (POST,GET,PUT, etc)</param>
/// <returns>A base64 string of the hash value</returns>
public string GenerateSignature(Uri url, string consumerKey, string consumerSecret, string token, string tokenSecret, out string normalizedUrl, out string normalizedRequestParameters) {
    normalizedUrl = null;
    normalizedRequestParameters = null;

    string signatureBase = GenerateSignatureBase(url, consumerKey, token, "POST", GenerateTimeStamp(), GenerateNonce(), "HMAC-SHA1", out normalizedUrl, out normalizedRequestParameters);
    HMACSHA1 hmacsha1 = new HMACSHA1();
    hmacsha1.Key = Encoding.ASCII.GetBytes(string.Format("{0}&{1}", UrlEncode(consumerSecret), IsNullOrEmpty(tokenSecret) ? "" : UrlEncode(tokenSecret)));
    return GenerateSignatureUsingHash(signatureBase, hmacsha1);
}

On Sunday, December 11, 2022 at 2:44:29 PM UTC-8 flavio.bu...@gmail.com wrote:
Hi, I am new to this platform, and I have a problem.

In order to send requests, I have to autenticate with Oauth 1.0.
I am following the instructions here:
How do I "Calculate" the signature value? 
Reply all
Reply to author
Forward
0 new messages