json Twitter API 错误 215
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17143985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Twitter API error 215
提问by Michael Giovanni Pumo
Today, we discovered one of my clients Twitter feeds became broken.
今天,我们发现我的一位客户的 Twitter 提要被破坏了。
I have tried switching to using the new API 1.1, but get the following error:
我尝试切换到使用新的 API 1.1,但出现以下错误:
{"errors":[{"message":"Bad Authentication data","code":215}]}
Even using their own example generates the same response:
即使使用他们自己的示例也会生成相同的响应:
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
Any idea what's up with this?
知道这是怎么回事吗?
Thanks, Mikey
谢谢,米奇
回答by Michael Giovanni Pumo
So, it seems Twitter's latest API 1.1 does not allowaccess without authentication - even for data that is seemingly public...like the latest 3 tweets from a timeline.
因此,似乎 Twitter 的最新 API 1.1不允许未经身份验证的访问 - 即使对于看似公开的数据......例如来自时间轴的最新 3 条推文。
The best article I have found on this (which gives a great solution) for read-access can be found here:
我在这方面找到的最好的文章(提供了一个很好的解决方案)用于读取访问可以在这里找到:
http://www.webdevdoor.com/php/authenticating-twitter-feed-timeline-oauth/
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 tokensand 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.
需要注意的一个有趣点是,现在,因为您必须使用访问令牌和密钥;所有请求都必须使用服务器端脚本进行。在此之前,我使用 jQuery 直接在 Twitters JSON API 上发出 AJAX 请求。现在,如果您想走 Javascript 路线,您必须 AJAX 在您自己的网站上请求一个动态脚本。
回答by Tim
Your example doesn't state whether you are authenticating, so I will assume you are not.
您的示例没有说明您是否在进行身份验证,因此我假设您没有进行身份验证。
Allmethods in API 1.1 require authentication via OAuth. https://dev.twitter.com/docs/auth/oauth
API 1.1 中的所有方法都需要通过 OAuth 进行身份验证。 https://dev.twitter.com/docs/auth/oauth
Unauthenticated access is discontinued permanently.
未经身份验证的访问将永久停止。

