Q:

Get auth token from URL

I am trying to get a Twitter oauth token using the below string.  How can I "run" the string and then get the token? 
This is the request string:
https://api.twitter.com/oauth/request_token?oauth_consumer_key=9TL0JGKTIv7GyOBeg8ynuxg&oauth_nonce=Xty48&oauth_signature=3skps99e6zkn0rcUGadVUEuHFon4%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1346603336

This is the result:
oauth_token=TBFdNoytaizrfMAWNZ6feqNz3BsozHk5AesIioX8u8Ec&oauth_token_secret=DtQ3jiUIeVdRcBAKwVQJRWpgKtEHi3m1ylk0nlsHCBj0&oauth_callback_confirmed=true

A:

See answer to this question.  It demonstrates how to get a value from the querystring.  
Here, I've altered it to take the name value collection as a parameter:
function getParameterByName(name, qs)
{
  name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
  var regexS = "[\\?&]"  + name + "=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(qs);
  if(results == null)
    return "";
  else
    return decodeURIComponent(results[1].replace(/\+/g, " "));
}

Usage:
var result = "oauth_token=TBF...&oauth_token_secret=DtQ...";
var token = getParameterByName("oauth_token", result);

