Sunday, March 27, 2011 at 12:00 AM.
system.verbs.apps.OAuth.getSignature
on getSignature (adrparams, url, consumerSecret, tokenSecret="", method="GET") {
<<Changes
<<3/26/11; 9:41:22 PM by DW
<<When calling string.urlEncode, pass the second optional param for the "full" encode. Otherwise characters like @ aren't encoded, and the signatures are declared invalid.
local (s = "");
for adr in adrparams {
s = s + nameof (adr^) + "=" + string.urlencode (adr^, true) + "&"};
s = string.delete (s, sizeof (s), 1); //delete last ampersand
s = method + "&" + string.urlencode (url, true) + "&" + string.urlencode (s, true);
OAuth.testing.sigbasestring = s;
local (key = string.urlencode (consumerSecret, true) + "&" + string.urlencode (tokenSecret, true));
s = base64.encode (OAuth.getHmac (s, key), infinity);
return (s)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.