Sunday, March 27, 2011 at 12:00 AM.


on authenticatedCall (endpoint, adrparams, consumerkey, consumersecret, token, tokensecret, adrresult, method="GET") {
		<<3/26/11; 10:11:38 AM by DW
			<<New optional parameter, method, default GET.
		<<3/6/09; 9:43:02 AM by DW
			<<Commented debugging code.
		<<2/12/09; 12:36:18 PM by DW
			<<Created. Herein lies the crux of the biscuit. The Raison d'etre. The piece de resistance. The purpose of our enterprise. Here, dear reader, is why we have been dancing as long as we have been, so we can make a call as we used to, before OAuth, one that doesn't involve sending a password in the clear. Hall Ay Loooooo Yah!! 
			<<You load up the params table with all the crap you want to send to the server. We'll add some of our own crap and a signature, and call the stinking server on your behalf. If the stinker decides to respond, we'll shoot the shit back atcha.
	adrparams^.oauth_version = "1.0";
	adrparams^.oauth_nonce = OAuth.getNonce ();
	adrparams^.oauth_timestamp = OAuth.getTimeStamp ();
	adrparams^.oauth_consumer_key = consumerKey;
	adrparams^.oauth_signature_method = "HMAC-SHA1";
	adrparams^.oauth_token = token;
	<<scratchpad.requestparams = adrparams^
	adrparams^.oauth_signature = OAuth.getSignature (adrparams, endpoint, consumersecret, tokenSecret, method);
	local (s = OAuth.httpClient (endpoint, adrparams, method));
	<<wp.newtextobject (s, @scratchpad.authenticatedcallresult); edit (@scratchpad.authenticatedcallresult)
	adrresult^ = s;
	return (true)}
<<bundle //test code
	<<local (endpoint = "", params)
	<<new (tabletype, @params)
	<<params.method = "dickhead"
	<< = "mcgee"
	<<params.killer = "kowalski"
	<<local (consumerkey = "key", consumersecret = "secret")
	<<authenticatedCall (endpoint, @params, consumerkey, consumersecret, scratchpad.accesstoken, scratchpad.accesstokensecret, @scratchpad.result)

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.