【问题标题】:Update twitter status更新推特状态
【发布时间】:2011-12-05 16:41:19
【问题描述】:

我使用了来自 twitter 的Anywhere 和来自它的connectButton,它们将我的应用程序与页面和帐户连接起来。我现在如何在没有文本框的情况下更新我的状态?只需发送一些需要新状态字符串的请求。找到this官网:

Example Requests

POST https://api.twitter.com/1/statuses/update.json
status=Maybe%20he%27ll%20finally%20find%20his%20keys.%20%23peterfalk&trim_user=true&include_entities=true 

所以我写了:

$.post('https://api.twitter.com/1/statuses/update.json', {status: 'test'},  function(res) {
    console.log(res);
});

它返回 401 身份验证错误。那么,有什么想法吗?

【问题讨论】:

    标签: javascript jquery twitter request


    【解决方案1】:

    我认为您将Twitter REST API 与@Anywhere 库混为一谈。仅当用户通过oAuth 进行身份验证并且应用程序在 HTTP 请求中提供了 oAuth 密钥时,才能使用 REST API。 @Anywhere 库是另一个库,它为使用 Javascript 库的 Web 开发人员提供了更轻松地访问 Twitter。

    您收到 401 身份验证错误,因为您没有在 API 请求中提供 oAuth 标头,这意味着用户未通过 API 身份验证。这与@Anywhere(连接按钮)的身份验证方案无关。

    您要么必须重写代码,以便首先通过 oAuth 对用户进行身份验证,然后使用 REST 调用发布推文,要么必须使用 @Anywhere 库的功能为用户提供推文框。

    【讨论】:

      猜你喜欢
      • 2011-06-19
      • 2014-08-27
      • 1970-01-01
      • 2010-11-14
      • 1970-01-01
      • 2010-10-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多