Today, we discovered one of my clients Twitter feeds became broken.

我try 使用新的API 1.1,但出现以下错误:

{"errors":[{"message":"Bad Authentication data","code":215}]}

即使使用他们自己的示例也会产生相同的响应:

https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=2

I am referencing the following documentation.

https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

知道这是怎么回事吗?

谢谢

推荐答案

所以,Twitter最新的API 1.1似乎可以实现not allow次无需身份验证的访问——即使是看似公开的数据...比如时间线上最新的3条推文.

关于这篇文章(它提供了一个很好的解决方案),我找到的关于读访问的最好的文章可以在这里找到:

http://www.webdevdoor.com/php/authenticating-twitter-feed-timeline-oauth/

I have followed the steps in the article above and can confirm it works great.

An interesting point to note, is that now, because you have to use access tokens and secret keys; all requests must be made with a server-side script. Prior to this I was using jQuery to make an AJAX request on Twitters JSON API directly. Now, you must AJAX request a dynamic script on your own website, if you wish to go down a Javascript route.

Json相关问答推荐

从Razor Pages的AJAX Json呈现DataTables问题.Net GET

JQ如何获取特定子元素的所有父母

如何在改装Android中将ResponseBody转换为JSONObject

Jolt Spec 跳过数组中的第一个元素

如何获取 JSON 对象字段值和同一 JSON 对象的下一个数组中的字段值?

go 语言中的 JSON 到 XML

Jolt 规范将父对象中的所有键应用于数组中的所有对象

如何在 Dart 中与多个 map (字典)相交

使用 jq Select 键:值并输出为数组

如何将动态复杂 json 解析为dart 对象或模型

从 json 对象中过滤掉所有出现的给定属性

为什么JsonConvert反序列化对象以int但不长失败

使用基本身份验证通过 CURL 发布 JSON

使用 Javascript 判断 JSON 对象是否包含值

错误字符串的长度超过了maxJsonLength属性设置的值

单元测试球衣 Restful Services

如何一次加载无限滚动中的所有条目以解析python中的HTML

JSON 模式 - 如果对象*不*包含特定属性则有效

从 Json 对象 Android 中获取字符串值

Javascript:如何判断 AJAX 响应是否为 JSON