我使用的是jsOAuth:https://github.com/bytespider/jsOAuth
我想转到推特OAuth页面,在那里用户输入他们的用户名/通行证,这样我的应用程序就可以获得用于推文等的另一个令牌。这是一个移动appI,知道不显示密钥和秘密等。)
当我点击这个按钮时,它不工作(你知道为什么吗?):
<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>发布于 2012-08-15 21:50:46
看一看,oauth.get需要3个参数,但您只有1个有效参数--匿名函数。
另外两个
alert("ahhhh");
window.location.replace( "index.html“);
不是有效的参数。设置要执行的成功和失败函数并将其用作参考文献中的参数可能会有所帮助。http://bytespider.github.com/jsOAuth/api-reference/#get
https://stackoverflow.com/questions/11857482
复制相似问题