I have a Javascript that builds my twitter request to Twitter. i am
using Crypto's Hmac(SHA-1) to encrypt my signaturebase string & key
the escape, and replace all function are used to convert to URL
encoded (replaceall takes care of the + and / that doesn't get encoded
with escape)

Is there anything that i am doing wrong when i have my parameters or
the request?

var Parameters =
["oauth_consumerkey="+sConsumerToken,"oauth_nonce="+nounce,"oauth_signature_method=HMAC-
SHA1","oauth_timestamp="+epoch,"oauth_token="+sAccessToken,"oauth_version=1.0","text="+sText,"user="+sUser];
var SortedParameters = Parameters.sort();
var joinParameters = SortedParameters.join("&");
var encodeParameters = escape(joinParameters);
encodeParameters=replaceAll(encodeParameters, [["+","%2B"],
["/","%2F"]]);

var encodebasestring = "POST&"+escape(NormalizedURL)
+"&"+escape(encodeParameters);

encodebasestring=replaceAll(encodebasestring, [["+","%2B"],
["/","%2F"]]);
signature_base_string = encodebasestring;



signature_key = sConsumerSecret+"&"+sAccessSecret;

signature =
Base64.encode(hmacsha1(signature_base_string,signature_key));
sAuthHeader = "OAuth realm='',oauth_nonce="+nounce
+",oauth_timestamp="+epoch+",oauth_consumer_key="+sConsumerToken
+",oauth_signature_method=HMAC-
SHA1,oauth_version=1.0,oauth_signature="+signature
+",oauth_token="+sAccessToken+",text="+sText;
goNVOut.Set("Header.Authorization:", sAuthHeader);

Reply via email to