So, I thought I'd learn a bit about Chrome extension development by making a small extension that just needs to send to Twitter. Funny thing is, Chrome extensions aren't hard, getting OAuth to work is.
I got the oauth.js library linked from the OAuth.net site and tried setting it up (http://oauth.googlecode.com/svn/code/javascript/). Problem is, every time I get a "Failed to validate oauth signature and token" error. I've checked signatures, and it seems OK, and even looked at the headers that it's sending what is expected and the raw signature string looks correct. I've used Google's signature checker and the signature is right, even made an app in C# to confirm. I've checked my time and it's OK. I even tried the Chrome provided OAuth library, but not no avail. I've hit a wall, I don't know what else to do. Here's the snippet of code, function getRequestToken() { var accessor = { consumerSecret: consumer.consumerSecret, consumerKey: consumer.consumerKey }; var message = { action: consumer.serviceProvider.requestTokenURL, method: "POST", parameters: []}; message.parameters.push(['oauth_callback', 'oob']); console.info("Starting OAuth requests"); doOAuthCall( message, accessor, function(data, textStatus) { console.log(data); var list = OAuth.getParameterMap( OAuth.decodeForm(data) ); consumer.token = list.oauth_token; consumer.tokenSecret = list.oauth_token_secret; getAuthentication(); }); } and I use a modified version of the doOAuthCall from OAuth Explorer, http://sevengoslings.net/~fangel/oauth-explorer/ function doOAuthCall( message, accessor, oncmp ) { OAuth.completeRequest(message, accessor); var bs = OAuth.SignatureMethod.getBaseString( message ); var ah = OAuth.getAuthorizationHeader('OAuth', message.parameters ); var cg = OAuth.addToURL( message.action, message.parameters ); console.log(bs); console.log(ah); jQuery.ajaxSetup({ 'beforeSend': function(xhr) { xhr.setRequestHeader("Authorization", ah) }, 'error': function(req, err) { oncmp(req.responseText, err ) } }); jQuery.get( message.action, [], oncmp, 'text'); } The Authorization header, Authorization:OAuth realm="OAuth", oauth_callback="oob", oauth_consumer_key="xxxxxxxxxxxxxxxxxxxxxx", oauth_version="1.0", oauth_timestamp="1278129985", oauth_nonce="zBRCtf", oauth_signature_method="HMAC-SHA1", oauth_signature="53drmjGf %2B1nMvD264pyx736L1hk%3D" Any help will be much appreciated, thanks :)