Issues with "Request Token"


I’m currently working on implementing an authorization feature into my app using the “three-legged” approach. In order to obtain the request token (using a POST call) I use Ajax to ask for the request token. My application is reporting ‘success’ after the call, as the server is returning an object; however, this object is strangely an HTML file- to be more specific, the HTML file of my program- instead of the string token to be exchanged for the access token. Has anyone experienced a problem of this sort?

function getTweets() {
  var currentTime = new Date();
  var time = currentTime.getTime();
  var code = getNonce();
	  type: "POST",
	  data: {
	    _url: ""
	  dataType: "text",
	  headers: {  
	    "oauth_nonce": code,
	    "oauth_callback": "",
      "oauth_signature_method": "HMAC-SHA1",
      "oauth_timestamp": time,
      "oauth_consumer_key": "xxx",       
      "oauth_signature": "xxx",
      "oauth_version": "1.0"
	  success: function(data) {
	  error: function(data) {
	    alert("Something went wrong...");

function getNonce() {
  var code = "";
  for (var i = 0; i < 20; i++) {
    code += Math.floor(Math.random() * 9).toString();
  return code;


We don’t generally offer support for attempts to use OAuth via Javascript – it’s not recommended by us.