Monday, November 08, 2010 at 12:01 AM.

system.verbs.apps.OAuth.getAccessToken

on getAccessToken (endpoint, consumerkey, consumersecret, token, tokensecret, verifier=nil, adrtoken, adrtokensecret) {
	<<Changes
		<<1/1/10; 11:31:09 AM by DW
			<<Add optional parameter, verifier, if non-nil, we send it as the oauth_verifier param, per the spec on the Twitter API wiki.
				<<http://apiwiki.twitter.com/Authentication
		<<3/6/09; 8:53:19 AM by DW
			<<Comment debugging code.
		<<2/12/09; 12:16:28 PM by DW
			<<Created. 
				<<http://term.ie/oauth/example/access_token.php?oauth_version=1.0&oauth_nonce=565e1bb17d9bc781d0ccb2c95411dd58&oauth_timestamp=1234469657&oauth_consumer_key=key&oauth_token=requestkey&oauth_signature_method=HMAC-SHA1&oauth_signature=qKdhday%2Fo1m2B%2Baabei4xC%2BBF3A%3D
	local (params);
	new (tabletype, @params);
	params.oauth_version = "1.0";
	params.oauth_nonce = OAuth.getNonce ();
	params.oauth_timestamp = OAuth.getTimeStamp ();
	params.oauth_consumer_key = consumerKey;
	params.oauth_signature_method = "HMAC-SHA1";
	params.oauth_token = token;
	if verifier != nil { //1/1/10 by DW
		params.oauth_verifier = verifier};
	params.oauth_signature = OAuth.getSignature (@params, endpoint, consumersecret, tokenSecret);
	local (s = OAuth.httpClient (endpoint, @params));
	<<wp.newtextobject (s, @scratchpad.accesstokenresult); edit (@scratchpad.accesstokenresult)
	bundle { //parse the resulting string
		adrtoken^ = string.nthfield (string.nthfield (s, "&", 1), "=", 2);
		adrtokensecret^ = string.nthfield (string.nthfield (s, "&", 2), "=", 2)}}
		<<oauth_token=accesskey&oauth_token_secret=accesssecret
<<bundle //test code
	<<local (endpoint = "http://term.ie/oauth/example/access_token.php")
	<<local (consumerkey = "key", consumersecret = "secret")
	<<getAccessToken (endpoint, consumerkey, consumersecret, scratchpad.token, scratchpad.tokensecret, @scratchpad.accesstoken, @scratchpad.accesstokensecret)



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.