【发布时间】:2011-07-12 18:53:08
【问题描述】:
我正在尝试使用我的移动应用在 Twitter 上发布推文。 我已通过登录与我的应用链接的 Twitter 页面来授权我的帐户。
现在,当我发布它时,它会发出“未发布”警报。
有人知道原因吗?
这是我的代码:
submit.addEventListener('click', function(){
var oAuthAdapter = new OAuthAdapter('SECRET KEY', 'KEY', 'HMAC-SHA1');
// load the access token for the service (if previously saved)
oAuthAdapter.loadAccessToken('twitter');
oAuthAdapter.loadAccessToken('twitter');
oAuthAdapter.send('https://api.twitter.com/1/statuses/update.json', [['status', 'Test from appcelerator ' + Math.random()]], 'Twitter', 'Published.', 'Not published.');
if (oAuthAdapter.isAuthorized() == false) {
// this function will be called as soon as the application is authorized
var receivePin = function(){
// get the access token with the provided pin/oauth_verifier
oAuthAdapter.getAccessToken('https://api.twitter.com/oauth/access_token');
// save the access token
oAuthAdapter.saveAccessToken('twitter');
};
// show the authorization UI and call back the receive PIN function
oAuthAdapter.showAuthorizeUI('https://api.twitter.com/oauth/authorize?' +
oAuthAdapter.getRequestToken('https://api.twitter.com/oauth/request_token'), receivePin);
}
});
【问题讨论】:
-
嗯..很难说。您的访问令牌/秘密似乎没问题,因为您的错误发生在 oauthadapter.send(..) 中。
-
我认为你只需要加载访问令牌......但这不是重点。
-
你已经知道那个页面了:ziodave.tumblr.com/post/746024933/…
-
设置您调试输出到最详细的级别,看看它说了什么。
标签: twitter oauth publish titanium tweets