How to generate oauth_signature, oauth_nonce and authorization Header in ember.js


#1

How I can generate oauth_signature and oauth_nonce in ember.js. I want to hit the twitter request_token url but it it take some authorization header along https://api.twitter.com/oauth/request_token.

So I have to create the oauth_signature and send the authorization header in ember.js I want to use twiiter signin in my website.

If I know I can generate oauth_signature, oauth_nonce and authorization header then I can work furthure

App.StaticConfig = Ember.Object.extend({

URL: null,
parameters: null,
consumerSecret: null,
encodedSignature: null,
callback: null,

});

var staticConfig = App.StaticConfig.create({

URL: 'https://api.twitter.com/oauth/request_token',
parameters: {
	   oauth_consumer_key : 'key'',
           oauth_nonce : 'kllo9940pd9333jh',
   	   oauth_timestamp : '1191242096',
           oauth_signature_method : 'HMAC-SHA1',
           oauth_version : '1.0',
},

consumerSecret : 'key',
encodedSignature : oauthSignature.generate('POST', URL, parameters, consumerSecret),

});

Ember.$.ajax({

            url:         'https://api.twitter.com/oauth/request_token',
            type:        'POST',
            contentType: "jsonp",
            headers: {
        		w"Authorization": 'OAuth oauth_callback='+ staticConfig.get('callback') +', oauth_consumer_key="", oauth_nonce="kllo9940pd9333jh", oauth_signature='+ staticConfig.get('encodedSignature') +', oauth_signature_method="HMAC-SHA1", oauth_timestamp="1191242096", oauth_version="1.0"'
    		},

I an using oauth_signatue.js but not succeed. Is In above code i am setting authorizatoin code correctly? Help me I am stuck