var consumerSecret = ‘key’;
var encodedSignature = oauthSignature.generate(httpMethod, URL, parameters, consumerSecret);
var callback = encodeURIComponent(‘http://127.0.0.1:3000/#/loginlotwitter’, ‘UTF-8’);
var consumerkey = encodeURIComponent(‘key’, ‘UTF-8’);
var oauthNonce = encodeURIComponent(‘kllo9940pd9333jh’, ‘UTF-8’);
var Authorizationheader = {
“Authorization”: ‘OAuth oauth_callback=’+ callback +’, oauth_consumer_key=’+ consumerkey +’, oauth_nonce=’+ oauthNonce +’, oauth_signature=’+ encodedSignature +’, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1191242096”, oauth_version=“1.0”’
};
Ember.$.ajax({
url: 'https://api.twitter.com/oauth/request_token',
type: httpMethod,
contentType: "jsonp",
contentType: 'application/x-www-form-urlencoded',
//headers: Authorizationheader,
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization",
'OAuth oauth_callback='+ callback +', oauth_consumer_key='+ consumerkey +', oauth_nonce='+ oauthNonce +', oauth_signature='+ encodedSignature +', oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_version="1.0"');
},
}).then(function(response) {
console.log('Successed');
console.log(response);
resolve (response);
}, function(xhr, status, error) {
console.log(error);
console.log('In Error');
reject(error);
});
Whats wrong in my code. every time I get Failed to validate oauth signature and token error.