Twitter Access Token


#1

Hi everyone!

I’ve got an authentication problem, that i can’t understand! My code is:

$('#page-home').live('pageinit', function() {
    var oauth;
    var requestParams;
    var options = { 
                        consumerKey: 'XXXX',
                        consumerSecret: 'XXXXX',       
                        accessTokenKey: '827171780-XXXXX',
                        accessTokenSecret: 'Ec5wereDF$XXXX',    
                        callbackUrl: 'https://dbspace.altervista.org' };
    var mentionsId = 0;
    var localStoreKey = "tmt5p1";
    $('#stage-data').hide();
    $('#stage-auth').hide();

 ...

});

For the to request options

and:

$('#oauthStatus').html('<span style="color:blue;">Getting authorization...</span>');
        mylog('options: '+JSON.stringify(options));
		oauth = OAuth(options);
		mylog('oauth: '+JSON.stringify(oauth));
		
        oauth.get('https://api.twitter.com/oauth/request_token',
                function(data) {
					mylog('====================AAAAAA');
                    requestParams = data.text;
                    mylog("AppLaudLog: requestParams: " + data.text);
                    window.plugins.childBrowser.showWebPage('https://api.twitter.com/oauth/authorize?'+data.text, 
                            { showLocationBar : false });                    
                },
                function(data) { 
					mylog('====================BBBBBBB');
                    alert('Error : No Authorization'); 
                    mylog("AppLaudLog: 2 Error " + JSON.stringify(data)); 
                    $('#oauthStatus').html('<span style="color:red;">Error during authorization</span>');
                }
    );
    mentionsId = 0;
});

For the token request… bu the response is always

Error 401: No authorization

What’s wrong…? Does I have to change the callbackUrl parameter?

Thank in advance

De


#2

What library are you using for this? Take a look at [node:204] for some tips to try.


#3

Hi episod,

I’m using Cordova 1.9 with Twitter e ChildBrowser plugins.

I’ve followed this useful tutorial! http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt5p1

But that problem remain…

It seems like oauth doesn’t authorize Twitter to use the access token…