0

I'm using jsOAuth: https://github.com/bytespider/jsOAuth

I want to get to the Twitter OAuth page where the user inputs their username/pass so that my app can then get the other token for tweeting etc. (FYI, it's not a web app. It's a mobile app[I know not to show the key and secrets etc.])

When I click this button it doesn't work(do you know why?):

<html>
<head>
<script src="jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jsOAuth-1.3.4.js"></script>
<script type="text/javascript">

function gimmiegimmie(){
var options = { 
        consumerKey: 'blahblahblah',
        consumerSecret: 'blahblahblah',
        callbackUrl: 'http://www.wouwqheqweiqiuwheiug8yg2g123e.com/' };
oauth = OAuth(options);
oauth.get('https://api.twitter.com/oauth/request_token',
function(data) {
    requestParams = data.text;
window.location.href = "https://api.twitter.com/oauth/authorize?"+data.text;},
alert("ahhhh");
window.location.replace( "index.html" );
    );}

</script>
</head>
<body  bgcolor="black"  >
<center>
<br>
<button type="button"  id="authbut" style="font-size:45px;height: 100px; width: 75%"     onClick="gimmiegimmie();">OAuth</button><br>
<br>
</center>
</body>
</html>
Dave
  • 477
  • 2
  • 5
  • 18

1 Answers1

1

Just looking at it, oauth.get is expecting 3 parameters, but you only have 1 valid parameter -- the anonymous function.

The other two --

alert("ahhhh");

window.location.replace( "index.html" );

are not valid parameters. It might be that setting up success and failure functions to be carried out and used as parameters as in the reference would help out. http://bytespider.github.com/jsOAuth/api-reference/#get

sandrum
  • 11
  • 2